diff --git a/src/main/scala/resonantinduction/archaic/fluid/tank/TileTank.scala b/src/main/scala/resonantinduction/archaic/fluid/tank/TileTank.scala index 3872fed73..ab0766f3c 100644 --- a/src/main/scala/resonantinduction/archaic/fluid/tank/TileTank.scala +++ b/src/main/scala/resonantinduction/archaic/fluid/tank/TileTank.scala @@ -11,19 +11,22 @@ import net.minecraft.item.ItemStack import net.minecraft.nbt.NBTTagCompound import net.minecraft.world.IBlockAccess import net.minecraftforge.common.util.ForgeDirection -import net.minecraftforge.fluids.{FluidContainerRegistry, FluidStack, FluidTank, IFluidTank} +import net.minecraftforge.fluids._ import org.lwjgl.opengl.GL11 import resonant.api.IRemovable.ISneakPickup +import resonant.api.grid.INode import resonant.content.prefab.RenderConnectedTexture +import resonant.lib.grid.node.Node import resonant.lib.render.{FluidRenderUtility, RenderUtility} import resonant.lib.transform.vector.Vector3 import resonant.lib.utility.FluidUtility import resonant.lib.utility.render.RenderBlockUtility +import resonant.lib.wrapper.BitmaskWrapper._ import resonantinduction.archaic.ArchaicContent import resonantinduction.archaic.fluid.gutter.NodePressureGravity import resonantinduction.core.Reference import resonantinduction.core.prefab.node.TileFluidProvider -import resonant.lib.wrapper.BitmaskWrapper._ + /** * Tile/Block class for basic Dynamic tanks * @@ -37,6 +40,16 @@ class TileTank extends TileFluidProvider(Material.iron) with ISneakPickup with R itemBlock = classOf[ItemBlockTank] fluidNode = new NodePressureGravity(this, 16 * FluidContainerRegistry.BUCKET_VOLUME) + { + override def connect[B <: IFluidHandler](obj: B, dir: ForgeDirection) + { + super.connect(obj, dir) + + if (obj.isInstanceOf[INode] && !obj.asInstanceOf[Node].parent.isInstanceOf[TileTank]) + _connectedMask = _connectedMask.closeMask(dir) + } + } + fluidNode.asInstanceOf[NodePressureGravity].maxFlowRate = FluidContainerRegistry.BUCKET_VOLUME fluidNode.onFluidChanged = () => markUpdate() diff --git a/src/main/scala/resonantinduction/core/prefab/node/NodePressure.scala b/src/main/scala/resonantinduction/core/prefab/node/NodePressure.scala index 40c66b456..15d98b1e4 100644 --- a/src/main/scala/resonantinduction/core/prefab/node/NodePressure.scala +++ b/src/main/scala/resonantinduction/core/prefab/node/NodePressure.scala @@ -22,11 +22,14 @@ class NodePressure(parent: INodeProvider, volume: Int = FluidContainerRegistry.B var maxPressure = 100 private var _pressure: Int = 0 - UpdateTicker.addUpdater(this) + override def reconstruct() + { + super.reconstruct() + UpdateTicker.addUpdater(this) + } def update(deltaTime: Double) { - println(world) if (!world.isRemote) { updatePressure() @@ -176,7 +179,7 @@ class NodePressure(parent: INodeProvider, volume: Int = FluidContainerRegistry.B this._pressure = pressure } - def canUpdate = !isInvalid + def canUpdate = !isInvalid && world != null def continueUpdate = !isInvalid } \ No newline at end of file