diff options
author | kekzdealer <kekzdealer@gmail.com> | 2020-06-23 02:17:11 +0200 |
---|---|---|
committer | kekzdealer <kekzdealer@gmail.com> | 2020-06-23 02:17:11 +0200 |
commit | 2178a42eca603aba98ca4e181c2c46597e638597 (patch) | |
tree | 2093f82aa2a11504ea3413e9ad0ed752f0b22bf8 /src/main/java/common | |
parent | 8a94750eec21b70a04eca7589c2626341a5eb83f (diff) | |
download | GT5-Unofficial-2178a42eca603aba98ca4e181c2c46597e638597.tar.gz GT5-Unofficial-2178a42eca603aba98ca4e181c2c46597e638597.tar.bz2 GT5-Unofficial-2178a42eca603aba98ca4e181c2c46597e638597.zip |
Started to imlements BeamTransmitter
Diffstat (limited to 'src/main/java/common')
-rw-r--r-- | src/main/java/common/Blocks.java | 2 | ||||
-rw-r--r-- | src/main/java/common/TileEntities.java | 1 | ||||
-rw-r--r-- | src/main/java/common/blocks/Block_BeamTransmitter.java | 55 | ||||
-rw-r--r-- | src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java | 68 | ||||
-rw-r--r-- | src/main/java/common/tileentities/TE_BeamTransmitter.java | 47 |
5 files changed, 120 insertions, 53 deletions
diff --git a/src/main/java/common/Blocks.java b/src/main/java/common/Blocks.java index efb5146137..304af71460 100644 --- a/src/main/java/common/Blocks.java +++ b/src/main/java/common/Blocks.java @@ -33,6 +33,7 @@ public class Blocks { public static Block jarIchor; public static Block lscLapotronicEnergyUnit; + public static Block beamTransmitter; public static Block spaceElevatorStructure; public static Block spaceElevatorCapacitor; @@ -89,6 +90,7 @@ public class Blocks { private static void registerBlocks_LSC() { lscLapotronicEnergyUnit = Block_LapotronicEnergyUnit.registerBlock(); + beamTransmitter = Block_BeamTransmitter.registerBlock(); } private static void registerBlocks_SpaceElevator() { diff --git a/src/main/java/common/TileEntities.java b/src/main/java/common/TileEntities.java index 963dd81e9f..9bb839feda 100644 --- a/src/main/java/common/TileEntities.java +++ b/src/main/java/common/TileEntities.java @@ -25,6 +25,7 @@ public class TileEntities { GameRegistry.registerTileEntity(TE_ThaumiumReinforcedJar.class, "kekztech_thaumiumreinforcedjar"); GameRegistry.registerTileEntity(TE_IchorJar.class, "kekztech_ichorjar"); //GameRegistry.registerTileEntity(TE_SpaceElevatorCapacitor.class, "kekztech_secapacitor"); + GameRegistry.registerTileEntity(TE_BeamTransmitter.class, "kekztech_beamtransmitter"); } public static void init() { diff --git a/src/main/java/common/blocks/Block_BeamTransmitter.java b/src/main/java/common/blocks/Block_BeamTransmitter.java new file mode 100644 index 0000000000..af7a837fdd --- /dev/null +++ b/src/main/java/common/blocks/Block_BeamTransmitter.java @@ -0,0 +1,55 @@ +package common.blocks; + +import common.tileentities.TE_BeamTransmitter; +import common.tileentities.TE_SpaceElevatorTether; +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class Block_BeamTransmitter extends Block { + + private static final Block_BeamTransmitter INSTANCE = new Block_BeamTransmitter(); + + private Block_BeamTransmitter() { + super(Material.glass); + } + + public static Block registerBlock() { + final String blockName = "kekztech_beamtransmitter_block"; + INSTANCE.setBlockName(blockName); + INSTANCE.setCreativeTab(CreativeTabs.tabMisc); + INSTANCE.setHardness(5.0f); + INSTANCE.setResistance(5.0f); + INSTANCE.setBlockTextureName(KekzCore.MODID + ":" + "Tether_top"); + GameRegistry.registerBlock(INSTANCE, blockName); + + return INSTANCE; + } + + @Override + public TileEntity createTileEntity(World world, int meta) { + return new TE_BeamTransmitter(); + } + + @Override + public boolean hasTileEntity(int meta) { + return true; + } + + @Override + public boolean isOpaqueCube() + { + return false; + } + + @Override + public boolean renderAsNormalBlock() + { + return false; + } + +} 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; + } +} |