diff options
Diffstat (limited to 'src/main/java/common/tileentities')
-rw-r--r-- | src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java | 68 | ||||
-rw-r--r-- | src/main/java/common/tileentities/TE_BeamTransmitter.java | 47 |
2 files changed, 62 insertions, 53 deletions
diff --git a/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java b/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java index ba523ab090..c8c987d7dc 100644 --- a/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java +++ b/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java @@ -66,12 +66,14 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_ON)}; + //return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_ON)}; + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_PIPE_STEEL)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_OFF)}; + //return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_OFF)}; + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE)}; } @Override @@ -91,16 +93,6 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { } @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public boolean doesEmptyContainers() { - return true; - } - - @Override public int getCapacity() { return (mfh != null) ? mfh.getCapacity() : 0; } @@ -108,8 +100,6 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide() && mfh != null) { - emptyContainers(aBaseMetaTileEntity); - fillContainers(aBaseMetaTileEntity); if(outputting && (aTick % 20 == 0)) { doAutoOutputPerSecond(aBaseMetaTileEntity); } @@ -117,43 +107,6 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { } /** - * Empty containers (cells, buckets, etc) from the GUI into the T.F.F.T - * @param aBaseMetaTileEntity - * this MetaTileEntity - */ - private void emptyContainers(IGregTechTileEntity aBaseMetaTileEntity) { - final FluidStack fluidFromCell = GT_Utility.getFluidForFilledItem(super.mInventory[super.getInputSlot()], true); - // Check if fluid is not null, could be inserted, and if there is space for the empty container - if (fluidFromCell != null && mfh.couldPush(fluidFromCell) - && aBaseMetaTileEntity.addStackToSlot(super.getOutputSlot(), GT_Utility.getContainerItem(super.mInventory[super.getInputSlot()], true), 1)) { - // Consume one filled container if it was emptied successfully - if(mfh.pushFluid(fluidFromCell, true) == fluidFromCell.amount) { - aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); - } - } - } - - /** - * Fill containers (cells, buckets, etc) in the GUI. The fluid used to fill containers will be the one that is - * selected through an Integrated Circuit in the T.F.F.T's controller GUI. - * @param aBaseMetaTileEntity - * this MetaTileEntity - */ - private void fillContainers(IGregTechTileEntity aBaseMetaTileEntity) { - final ItemStack cellFromFluid = GT_Utility.fillFluidContainer( - mfh.getFluidCopy(mfh.getSelectedFluid()), super.mInventory[super.getInputSlot()], false, true); - // Check if cell is not null and if there is space for the filled container - if (cellFromFluid != null && aBaseMetaTileEntity.addStackToSlot(super.getOutputSlot(), cellFromFluid, 1)) { - // Convert back to FluidStack to learn the container capacity... - final FluidStack fluidCapacityStack = GT_Utility.getFluidForFilledItem(cellFromFluid, true); - // Consume one empty container if it was filled successfully - if(mfh.pullFluid(fluidCapacityStack, true) == fluidCapacityStack.amount) { - aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); - } - } - } - - /** * Handle the Multi Hatch's auto-output feature. Should be called once per second only. * @param aBaseMetaTileEntity * this MetaTileEntity @@ -229,12 +182,21 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == super.getOutputSlot(); + return false; } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == super.getInputSlot(); + return false; + } + + @Override + public boolean canTankBeFilled() { + return true; } + @Override + public boolean canTankBeEmptied() { + return true; + } } diff --git a/src/main/java/common/tileentities/TE_BeamTransmitter.java b/src/main/java/common/tileentities/TE_BeamTransmitter.java new file mode 100644 index 0000000000..74cb845fc4 --- /dev/null +++ b/src/main/java/common/tileentities/TE_BeamTransmitter.java @@ -0,0 +1,47 @@ +package common.tileentities; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import org.joml.Vector3i; +import org.joml.Vector3ic; + +public class TE_BeamTransmitter extends TileEntity { + + private final Vector3ic position; + + private Vector3ic target = new Vector3i(10, 20, 10); + private double distanceCache; + private boolean distanceCacheValid = false; + + public TE_BeamTransmitter() { + position = new Vector3i(super.xCoord, super.yCoord, super.zCoord); + } + + public Vector3ic getTargetPosition() { + return target; + } + + public double getDistanceFromTarget() { + if (!distanceCacheValid) { + distanceCache = position.distance(target); + distanceCacheValid = true; + } + return distanceCache; + } + + @SideOnly(Side.CLIENT) + @Override + public double getMaxRenderDistanceSquared() { + // 4k is standard, 65k is what the vanilla beacon uses + return 65536.0D; + } + + @Override + @SideOnly(Side.CLIENT) + public AxisAlignedBB getRenderBoundingBox() { + // Make it so the beam is still rendered even when the source block is out of sight + return INFINITE_EXTENT_AABB; + } +} |