From 59336384f87e6170afcedfc80074beeeceb862a4 Mon Sep 17 00:00:00 2001 From: Calclavia Date: Fri, 7 Mar 2014 18:24:19 +0800 Subject: [PATCH] Temporarily removed errors --- .../archaic/fluid/gutter/TileGutter.java | 57 ++++++++++++------- .../core/fluid/TilePressurizedNode.java | 39 ------------- .../core/grid/fluid/PressureNode.java | 4 +- 3 files changed, 40 insertions(+), 60 deletions(-) diff --git a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java index d8535b223..46a27e847 100644 --- a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java +++ b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java @@ -8,16 +8,14 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidHandler; import resonantinduction.core.ResonantInduction; -import resonantinduction.core.fluid.IPressurizedNode; import resonantinduction.core.fluid.TilePressurizedNode; +import resonantinduction.core.grid.fluid.IPressureNodeProvider; import resonantinduction.core.grid.fluid.PressureNode; import universalelectricity.api.vector.Vector3; import calclavia.lib.prefab.vector.Cuboid; @@ -39,8 +37,42 @@ public class TileGutter extends TilePressurizedNode isOpaqueCube = false; normalRender = false; - node = new ExtendedPressureNode(this) + node = new PressureNode(this) { + @Override + public void recache() + { + synchronized (connections) + { + connections.clear(); + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + TileEntity tile = position().translate(dir).getTileEntity(world()); + + if (tile instanceof IFluidHandler) + { + if (tile instanceof IPressureNodeProvider) + { + PressureNode check = ((IPressureNodeProvider) tile).getNode(dir.getOpposite()); + + if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this)) + { + renderSides = WorldUtility.setEnableSide(renderSides, dir, true); + connections.put(check, dir); + + } + } + else + { + renderSides = WorldUtility.setEnableSide(renderSides, dir, true); + connections.put(tile, dir); + } + } + } + } + } + @Override public int getPressure(ForgeDirection dir) { @@ -100,7 +132,7 @@ public class TileGutter extends TilePressurizedNode { if (getInternalTank().getFluidAmount() > 0) { - int pressure = getPressure(null); + int pressure = node.pressure; for (int i = 2; i < 6; i++) { @@ -111,7 +143,7 @@ public class TileGutter extends TilePressurizedNode if (checkTile instanceof TileGutter) { - int deltaPressure = pressure - ((TileGutter) checkTile).getPressure(null); + int deltaPressure = pressure - ((TileGutter) checkTile).node.getPressure(dir.getOpposite()); entity.motionX += 0.01 * dir.offsetX * deltaPressure; entity.motionY += 0.01 * dir.offsetY * deltaPressure; @@ -172,19 +204,6 @@ public class TileGutter extends TilePressurizedNode } } - @Override - public void validateConnectionSide(TileEntity tileEntity, ForgeDirection side) - { - if (!this.worldObj.isRemote) - { - if (tileEntity instanceof IFluidHandler) - { - renderSides = WorldUtility.setEnableSide(renderSides, side, true); - node.getConnections().connectedBlocks[side.ordinal()] = tileEntity; - } - } - } - @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { diff --git a/src/main/java/resonantinduction/core/fluid/TilePressurizedNode.java b/src/main/java/resonantinduction/core/fluid/TilePressurizedNode.java index ed37d3183..ee8784b39 100644 --- a/src/main/java/resonantinduction/core/fluid/TilePressurizedNode.java +++ b/src/main/java/resonantinduction/core/fluid/TilePressurizedNode.java @@ -21,37 +21,6 @@ public abstract class TilePressurizedNode extends TileFluidNode implements IPres { protected PressureNode node; - static class ExtendedPressureNode extends PressureNode - { - public ExtendedPressureNode(IPressureNodeProvider parent) - { - super(parent); - } - - @Override - public void recache() - { - if (!world().isRemote) - { - byte previousConnections = renderSides; - connectedBlocks = new Object[6]; - renderSides = 0; - - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) - { - validateConnectionSide(new Vector3(this).translate(dir).getTileEntity(worldObj), dir); - } - - /** Only send packet updates if visuallyConnected changed. */ - if (previousConnections != renderSides) - { - sendRenderUpdate(); - } - } - - } - }; - public TilePressurizedNode(Material material) { super(material); @@ -100,14 +69,6 @@ public abstract class TilePressurizedNode extends TileFluidNode implements IPres return new FluidTankInfo[] { getInternalTank().getInfo() }; } - /** - * Checks to make sure the connection is valid to the tileEntity - * - * @param tileEntity - the tileEntity being checked - * @param side - side the connection is too - */ - public abstract void validateConnectionSide(TileEntity tileEntity, ForgeDirection side); - public int getSubID() { return this.colorID; diff --git a/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java b/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java index 67504f0ad..9a2cf6a0e 100644 --- a/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java +++ b/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java @@ -21,7 +21,7 @@ import codechicken.multipart.TMultiPart; public class PressureNode extends Node { protected byte connectionMap = Byte.parseByte("111111", 2); - protected int pressure = 0; + public int pressure = 0; public PressureNode(IPressureNodeProvider parent) { @@ -174,7 +174,7 @@ public class PressureNode extends Node