diff options
Diffstat (limited to 'src/main/java/common/tileentities')
8 files changed, 0 insertions, 1045 deletions
diff --git a/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java b/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java deleted file mode 100644 index 1875a097e5..0000000000 --- a/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java +++ /dev/null @@ -1,224 +0,0 @@ -package common.tileentities; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import org.joml.Vector3i; - -import common.Blocks; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; - -public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBase { - - private final Block CASING = GregTech_API.sBlockCasings3; - private final int CASING_META = 12; - private final int CASING_TEXTURE_ID = 44; - - private final Block CHAMBER_OFF = Blocks.reactorChamberOFF; - private final Block CHAMBER_ON = Blocks.reactorChamberON; - private final Block CONTROL_ROD = Blocks.reactorControlRod; - - private boolean euMode = true; - - public GTMTE_ModularNuclearReactor(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GTMTE_ModularNuclearReactor(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { - return new GTMTE_ModularNuclearReactor(super.mName); - } - - @Override - public String[] getDescription() { - return new String[] { "Disabled" }; - /* - * final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder(); - * b.addInfo("Can be built, BUT DOES NOT WORK") .addInfo("Converts fissile material and outputs power or heat") - * .addSeparator() .addInfo("EU-MODE:") - * .addInfo(" Directly outputs electricity depending on inserted fuel rods") .addSeparator() - * .addInfo("COOLANT-MODE:") .addInfo(" Requires coolant to be pumped into the reactor.") - * .addInfo(" Coolant is heated and should be drained and converted to electricity by other means.") - * .addSeparator() .addInfo("NOTES:") .addInfo(" Does NOT use Industrialcraft 2 reactor components!") - * .addInfo(" Consult controller GUI on how to arrange the outer casings.") .addSeparator() - * .beginStructureBlock(7, 6, 7) .addController("Front bottom Center") - * .addCasingInfo("Radiation Proof Machine Casing", 100) .addOtherStructurePart("Control Rods", - * "Four pillars, four blocks high each. Diagonal to the inner edges of the shell") - * .addOtherStructurePart("Nuclear Reactor Chamber", - * "17 of them to fill out the rest of the floor inside the shell") - * .addDynamoHatch("ONLY in EU-mode, at least one") .addOtherStructurePart("Input Bus, Output Bus", - * "Optional but required for automation") .addOtherStructurePart("Input Hatch, Output Hatch", - * "ONLY in Coolant-Mode, at least one each") .signAndFinalize("Kekzdealer"); - * if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return b.getInformation(); } else { return - * b.getStructureInformation(); } - */ - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int colorIndex, final boolean aActive, final boolean aRedstone) { - return side == facing - ? new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - new GT_RenderedTexture( - aActive ? Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE - : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER) } - : new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID) }; - } - - @Override - public boolean isCorrectMachinePart(ItemStack stack) { - return true; - } - - @Override - public boolean checkRecipe(ItemStack stack) { - return false; - } - - @Override - public void onPostTick(IGregTechTileEntity thisController, long aTick) { - super.onPostTick(thisController, aTick); - - if (super.getBaseMetaTileEntity().isActive()) { - // Switch to ON blocks - } else { - // Switch to OFF blocks - } - } - - @Override - public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { - // Figure out the vector for the direction the back face of the controller is facing - final int dirX = thisController.getBackFacing().offsetX; - final int dirZ = thisController.getBackFacing().offsetZ; - int minCasingAmount = 100; - boolean checklist = true; // if this is still true at the end, machine is good to go :) - - // Determine the ground level center of the structure - final Vector3i center = new Vector3i( - thisController.getXCoord(), - thisController.getYCoord(), - thisController.getZCoord()).add(dirX * 3, 0, dirZ * 3); - // Scan for outer tube - // - Scan sides - for (int x = -3; x <= 3; x++) { - for (int z = -3; z <= 3; z++) { - // Only scan the three wide even sides, skip rest - if ((Math.abs(x) <= 1 && Math.abs(z) == 3) || (Math.abs(z) <= 1 && Math.abs(x) == 3)) { - for (int h = 0; h < 6; h++) { - final Vector3i pos = new Vector3i(center.x() + x, center.y() + h, center.z() + z); - if (h == 0 && pos.x() == thisController.getXCoord() - && pos.y() == thisController.getYCoord() - && pos.z() == thisController.getZCoord()) { - // Ignore controller - continue; - } else if (thisController.getBlock(pos.x(), pos.y(), pos.z()) == CASING - && thisController.getMetaID(pos.x(), pos.y(), pos.z()) == CASING_META) { - minCasingAmount--; - } else { - checklist = false; - } - } - } - } - } - // - Scan corners of tube - for (int x = -2; x <= 2; x++) { - for (int z = -2; z <= 2; z++) { - // Only scan the four corners, skip rest - if (Math.abs(x) + Math.abs(z) == 4) { - for (int h = 0; h < 6; h++) { - final Vector3i pos = new Vector3i(center.x() + x, center.y() + h, center.z() + z); - if (h == 0 && pos.x() == thisController.getXCoord() - && pos.y() == thisController.getYCoord() - && pos.z() == thisController.getZCoord()) { - // Ignore controller - continue; - } else if (thisController.getBlock(pos.x(), pos.y(), pos.z()) == CASING - && thisController.getMetaID(pos.x(), pos.y(), pos.z()) == CASING_META) { - minCasingAmount--; - } else { - checklist = false; - } - } - } - } - } - // Scan ground layer - for (int x = -2; x <= 2; x++) { - for (int z = -2; z <= 2; z++) { - if (!(thisController.getBlock(center.x() + x, center.y(), center.z() + z) == CASING - && thisController.getMetaID(center.x() + x, center.y(), center.z() + z) == CASING_META)) { - checklist = false; - } else { - minCasingAmount--; - } - } - } - // Scan reactor chambers - for (int x = -2; x <= 2; x++) { - for (int z = -2; z <= 2; z++) { - // Skip if diagonal, don't skip center - if (Math.abs(x) == Math.abs(z) && !(x == 0 && z == 0)) { - continue; - } - if (!(thisController.getBlock(center.x() + x, center.y() + 1, center.z() + z) == CHAMBER_OFF - || thisController.getBlock(center.x() + x, center.y() + 1, center.z() + z) == CHAMBER_ON)) { - checklist = false; - } - } - } - // Scan control rods - for (int h = 1; h < 5; h++) { - for (int x = -1; x <= 1; x++) { - for (int z = -1; z <= 1; z++) { - // Only check diagonal - if (x == 0 || z == 0) { - continue; - } - if (!(thisController.getBlock(center.x() + x, center.y() + h, center.z() + z) == CONTROL_ROD)) { - checklist = false; - } - } - } - } - - if (minCasingAmount > 0) { - checklist = false; - } - - return checklist; - } - - @Override - public int getMaxEfficiency(ItemStack stack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack stack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack stack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack stack) { - return false; - } -} diff --git a/src/main/java/common/tileentities/GTMTE_SpaceElevator.java b/src/main/java/common/tileentities/GTMTE_SpaceElevator.java deleted file mode 100644 index 421a2e2760..0000000000 --- a/src/main/java/common/tileentities/GTMTE_SpaceElevator.java +++ /dev/null @@ -1,260 +0,0 @@ -package common.tileentities; - -import java.util.ArrayList; -import java.util.HashSet; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import common.Blocks; - -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; -import util.Vector3i; -import util.Vector3ic; - -public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { - - private static final Block BASE_BLOCK = Blocks.spaceElevatorStructure; - private static final Block CAP_BLOCK = Blocks.spaceElevatorCapacitor; - private static final Block TETHER_BLOCK = Blocks.spaceElevatorTether; - private static final int BASE_META = 0; - private static final int COIL_HOLDER_META = 1; - private static final String glassNameBorosilicate = "BW_GlasBlocks"; - private static final int HATCH_OVERLAY_ID = 16; - - // Scan positions for capacitor banks - // Start with top left bank, clockwise - // Start with top middle pillar within bank, clockwise, middle last - private static final int[] bankOffsetsX = { -7, 5, 5, -7 }; - private static final int[] bankOffsetsY = { -7, -7, 5, 5 }; - private static final int[] scanOffsetsX = { 1, 2, 1, 0, 1 }; - private static final int[] scanOffsetsY = { 0, 1, 2, 1, 1 }; - - private final HashSet<TE_SpaceElevatorCapacitor> capacitors = new HashSet<>(); - private long lastLaunchEUCost = 0; - - public GTMTE_SpaceElevator(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GTMTE_SpaceElevator(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { - return new GTMTE_SpaceElevator((super.mName)); - } - - @Override - public String[] getDescription() { - return new String[] { "Disabled" }; - /* - * final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder(); - * b.addInfo("Access for your Space Station!") - * .addInfo("Check out the wiki on my github if you are having trouble with the structure") - * .addInfo("Regenerative Breaking will recover up to X% of the energy spent on launch") - * .addInfo("Energy recovered depends on coil tier: +10% per coil tier, up to 90%") .addSeparator() - * .beginStructureBlock(15, 11, 15) .addController("Bottom Center") - * .addEnergyHatch("Instead of any casing in the bottom floor") - * .addMaintenanceHatch("Instead of any casing in the bottom floor") - * .addCasingInfo("Solid Steel Machine Casing", 320) .addOtherStructurePart("Any EBF coil", - * "40x, have to be all the same") .addOtherStructurePart("Space Elevator Tether", "4x") - * .addOtherStructurePart("Space Elevator Cabin Block", "42x") - * .addOtherStructurePart("Space Elevator Cabin Guide", "8x") .signAndFinalize("Kekzdealer"); - * if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return b.getInformation(); } else { return - * b.getStructureInformation(); } - */ - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - ITexture[] sTexture = new ITexture[] { new GT_RenderedTexture( - Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; - if (side == facing && aActive) { - sTexture = new ITexture[] { new GT_RenderedTexture( - Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; - } - return sTexture; - } - - @Override - public boolean isCorrectMachinePart(ItemStack stack) { - return true; - } - - @Override - public boolean checkRecipe(ItemStack stack) { - this.mProgresstime = 1; - this.mMaxProgresstime = 1; - this.mEUt = 0; - this.mEfficiencyIncrease = 10000; - return true; - } - - public Vector3ic rotateOffsetVector(Vector3ic forgeDirection, int x, int y, int z) { - final Vector3i offset = new Vector3i(0, 0, 0); - // either direction on y-axis - if (forgeDirection.y() == -1) { - offset.x = x; - offset.y = z; - offset.z = y; - } - - return offset; - } - - @Override - public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { - // Make sure the controller is either facing up or down - if (thisController.getFrontFacing().offsetY != 0) { - return false; - } - - // Figure out the vector for the direction the back face of the controller is facing - final Vector3ic forgeDirection = new Vector3i( - thisController.getBackFacing().offsetX, - thisController.getBackFacing().offsetY, - thisController.getBackFacing().offsetZ); - boolean formationChecklist = true; - int minCasingAmount = 320; - int firstCoilMeta = -1; - capacitors.clear(); - - // Base floor - for (int X = -7; X <= 7; X++) { - for (int Y = -7; Y <= 7; Y++) { - if (X == 0 && Y == 0) { - continue; // Skip controller - } - - final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0); - final IGregTechTileEntity currentTE = thisController - .getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); - - // Tries to add TE as either of those kinds of hatches. - // The number is the texture index number for the texture that needs to be painted over the hatch - // texture - if (!super.addMaintenanceToMachineList(currentTE, HATCH_OVERLAY_ID) - && !this.addEnergyInputToMachineList(currentTE, HATCH_OVERLAY_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - if ((thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == BASE_BLOCK) - && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == BASE_META)) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } - } - System.out.println(""); - // Capacitor banks - for (int bank = 0; bank < 4; bank++) { - for (int Z = 1; Z <= 5; Z++) { - for (int scan = 0; scan < 5; scan++) { - final Vector3ic offset = rotateOffsetVector( - forgeDirection, - bankOffsetsX[bank] + scanOffsetsX[scan], - bankOffsetsY[bank] + scanOffsetsY[scan], - Z); - if (Z == 1 || Z == 5) { - // Check for casings - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == BASE_BLOCK - && thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == BASE_META) { - minCasingAmount--; - } else { - formationChecklist = false; - } - } else { - if (scan == 4) { - // Check for capacitors - final TileEntity te = thisController - .getTileEntityOffset(offset.x(), offset.y(), offset.z()); - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CAP_BLOCK - && te instanceof TE_SpaceElevatorCapacitor) { - capacitors.add((TE_SpaceElevatorCapacitor) te); - } else { - formationChecklist = false; - } - } else { - // Check for Glass - if (!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName() - .equals(glassNameBorosilicate)) { - formationChecklist = false; - } - } - } - } - } - } - // Anchor - - // Coil holders - - // Coils - - if (minCasingAmount > 0) { - formationChecklist = false; - } - - for (TE_SpaceElevatorCapacitor cap : capacitors) { - cap.setIsDamaged(false); - } - - return formationChecklist; - } - - @Override - public String[] getInfoData() { - final ArrayList<String> ll = new ArrayList<>(); - ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET); - - ll.add( - "Maintenance Status: " + ((super.getRepairStatus() == super.getIdealStatus()) - ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); - ll.add("---------------------------------------------"); - - final String[] a = new String[ll.size()]; - return ll.toArray(a); - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public int getMaxEfficiency(ItemStack stack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack stack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack stack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack stack) { - return false; - } -} diff --git a/src/main/java/common/tileentities/TE_BeamTransmitter.java b/src/main/java/common/tileentities/TE_BeamTransmitter.java deleted file mode 100644 index e8999e393f..0000000000 --- a/src/main/java/common/tileentities/TE_BeamTransmitter.java +++ /dev/null @@ -1,49 +0,0 @@ -package common.tileentities; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; - -import org.joml.Vector3i; -import org.joml.Vector3ic; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class TE_BeamTransmitter extends TileEntity { - - private final Vector3ic position; - - private final 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; - } -} diff --git a/src/main/java/common/tileentities/TE_ItemProxyCable.java b/src/main/java/common/tileentities/TE_ItemProxyCable.java deleted file mode 100644 index 1dc539c89e..0000000000 --- a/src/main/java/common/tileentities/TE_ItemProxyCable.java +++ /dev/null @@ -1,155 +0,0 @@ -package common.tileentities; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -public class TE_ItemProxyCable extends TileEntity { - - private static final float THICKNESS = 0.5F; - private byte connections = 0; - private byte connectionAllowed = 63; - private String idCache = null; - - public TE_ItemProxyCable() {} - - @Override - public void updateEntity() { - // Check all 6 sides and connect the conduit if it is allowed to - for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - final TileEntity te = super.getWorldObj().getTileEntity( - super.xCoord + side.offsetX, - super.yCoord + side.offsetY, - super.zCoord + side.offsetZ); - if (te instanceof TE_ItemProxyCable) { - final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; - setConnection(side, cable.isConnectionAllowed(side.getOpposite())); - } else { - setConnection(side, false); - } - } - } - - public static float getThickness() { - return THICKNESS; - } - - /** - * Builds a simple unique identifier for this TileEntity by appending the x, y, and z coordinates in a string. - * - * @return unique identifier for this TileEntity - */ - public String getIdentifier() { - if (idCache == null) { - idCache = "" + super.xCoord + super.yCoord + super.zCoord; - return idCache; - } else { - return idCache; - } - } - - /** - * 0 0 0 0 0 0 0 0 = 0 -> no connection </br> - * 0 0 0 0 0 0 0 1 = 1 -> down </br> - * 0 0 0 0 0 0 1 0 = 2 -> up </br> - * 0 0 0 0 0 1 0 0 = 4 -> north </br> - * 0 0 0 0 1 0 0 0 = 8 -> south </br> - * 0 0 0 1 0 0 0 0 = 16 -> west </br> - * 0 0 1 0 0 0 0 0 = 32 -> east </br> - * - * @param side The side for which to set the connection status. - * @param connected Whether this side should be connected or not - * @return True if the connection was allowed - */ - public boolean setConnection(ForgeDirection side, boolean connected) { - if (isConnectionAllowed(side)) { - switch (side) { - case DOWN: - connections = (byte) ((connected) ? connections | 1 : connections ^ 1); - break; - case UP: - connections = (byte) ((connected) ? connections | 2 : connections ^ 2); - break; - case NORTH: - connections = (byte) ((connected) ? connections | 4 : connections ^ 4); - break; - case SOUTH: - connections = (byte) ((connected) ? connections | 8 : connections ^ 8); - break; - case WEST: - connections = (byte) ((connected) ? connections | 16 : connections ^ 16); - break; - case EAST: - connections = (byte) ((connected) ? connections | 32 : connections ^ 32); - break; - default: - return false; - } - return true; - } else { - return false; - } - } - - public boolean isConnected(ForgeDirection side) { - switch (side) { - case DOWN: - return (connections & 1) == 1; - case UP: - return (connections & 2) == 2; - case NORTH: - return (connections & 4) == 4; - case SOUTH: - return (connections & 8) == 8; - case WEST: - return (connections & 16) == 16; - case EAST: - return (connections & 32) == 32; - default: - return false; - } - } - - public void setConnectionAllowed(ForgeDirection side, boolean allowed) { - switch (side) { - case DOWN: - connectionAllowed = (byte) ((allowed) ? connectionAllowed | 1 : connectionAllowed ^ 1); - break; - case UP: - connectionAllowed = (byte) ((allowed) ? connectionAllowed | 2 : connectionAllowed ^ 2); - break; - case NORTH: - connectionAllowed = (byte) ((allowed) ? connectionAllowed | 4 : connectionAllowed ^ 4); - break; - case SOUTH: - connectionAllowed = (byte) ((allowed) ? connectionAllowed | 8 : connectionAllowed ^ 8); - break; - case WEST: - connectionAllowed = (byte) ((allowed) ? connectionAllowed | 16 : connectionAllowed ^ 16); - break; - case EAST: - connectionAllowed = (byte) ((allowed) ? connectionAllowed | 32 : connectionAllowed ^ 32); - break; - default: - break; - } - } - - public boolean isConnectionAllowed(ForgeDirection side) { - switch (side) { - case DOWN: - return (connectionAllowed & 1) == 1; - case UP: - return (connectionAllowed & 2) == 2; - case NORTH: - return (connectionAllowed & 4) == 4; - case SOUTH: - return (connectionAllowed & 8) == 8; - case WEST: - return (connectionAllowed & 16) == 16; - case EAST: - return (connectionAllowed & 32) == 32; - default: - return false; - } - } -} diff --git a/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java b/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java deleted file mode 100644 index 7d58a21c61..0000000000 --- a/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java +++ /dev/null @@ -1,175 +0,0 @@ -package common.tileentities; - -import java.util.HashSet; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -public class TE_ItemProxyEndpoint extends TileEntity implements ISidedInventory { - - private byte channel = -1; - private IInventory proxyInventory = null; - private int tickCounter = 0; - - public TE_ItemProxyEndpoint() { - channel = 0; - } - - public void setChannel(byte channel) { - this.channel = channel; - } - - public int getChannel() { - return channel; - } - - @Override - public void updateEntity() { - if (tickCounter == 20) { - if (channel != -1) { - proxyInventory = searchSource(); - } - tickCounter = 0; - } - tickCounter++; - } - - private TE_ItemProxySource searchSource() { - - final HashSet<TE_ItemProxySource> sources = new HashSet<>(); - final HashSet<String> visited = new HashSet<>(); - - for (ForgeDirection next : ForgeDirection.VALID_DIRECTIONS) { - final TileEntity te = super.getWorldObj().getTileEntity( - super.xCoord + next.offsetX, - super.yCoord + next.offsetY, - super.zCoord + next.offsetZ); - if (te instanceof TE_ItemProxyCable) { - final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; - if (cable.isConnected(next.getOpposite())) { - searchSourceRecursive(sources, visited, next.getOpposite(), cable); - } - } - } - - if (sources.isEmpty()) { - return null; - } else { - return sources.iterator().next(); - } - } - - private void searchSourceRecursive(HashSet<TE_ItemProxySource> sources, HashSet<String> visited, - ForgeDirection from, TE_ItemProxyCable nextTarget) { - - if (!visited.contains(nextTarget.getIdentifier())) { - visited.add(nextTarget.getIdentifier()); - - for (ForgeDirection next : ForgeDirection.VALID_DIRECTIONS) { - if (next != from) { - final TileEntity te = super.getWorldObj().getTileEntity( - nextTarget.xCoord + next.offsetX, - nextTarget.yCoord + next.offsetY, - nextTarget.zCoord + next.offsetZ); - if (te instanceof TE_ItemProxyCable) { - final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; - if (cable.isConnected(next.getOpposite())) { - searchSourceRecursive(sources, visited, next.getOpposite(), cable); - } - } else if (te instanceof TE_ItemProxySource) { - sources.add((TE_ItemProxySource) te); - } - } - } - } - } - - @Override - public int getSizeInventory() { - return 1; - } - - @Override - public ItemStack getStackInSlot(int slot) { - if (proxyInventory != null && slot == 0) { - return proxyInventory.getStackInSlot(channel); - } else { - return null; - } - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - if (proxyInventory != null && slot == 0) { - return proxyInventory.decrStackSize(channel, amount); - } else { - return null; - } - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return (proxyInventory != null) ? proxyInventory.getStackInSlotOnClosing(channel) : null; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack itemStack) { - if (proxyInventory != null && slot == 0) { - proxyInventory.setInventorySlotContents(channel, itemStack); - } - } - - @Override - public String getInventoryName() { - return (proxyInventory != null) ? "Connected: " + proxyInventory.getInventoryName() : "Untethered Proxy"; - } - - @Override - public boolean hasCustomInventoryName() { - return true; - } - - @Override - public int getInventoryStackLimit() { - return (proxyInventory != null) ? proxyInventory.getInventoryStackLimit() : 0; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return true; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemStack) { - if (proxyInventory != null && slot == 0) { - return proxyInventory.isItemValidForSlot(channel, itemStack); - } else { - return false; - } - } - - @Override - public int[] getAccessibleSlotsFromSide(int side) { - return new int[] { 0 }; - } - - @Override - public boolean canInsertItem(int slot, ItemStack itemStack, int side) { - return isItemValidForSlot(slot, itemStack); - } - - @Override - public boolean canExtractItem(int slot, ItemStack itemStack, int side) { - return slot == 0; - } -} diff --git a/src/main/java/common/tileentities/TE_ItemProxySource.java b/src/main/java/common/tileentities/TE_ItemProxySource.java deleted file mode 100644 index 31403f5352..0000000000 --- a/src/main/java/common/tileentities/TE_ItemProxySource.java +++ /dev/null @@ -1,105 +0,0 @@ -package common.tileentities; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -public class TE_ItemProxySource extends TileEntity implements IInventory { - - private final ItemStack[] slots = new ItemStack[16]; - private String idCache = null; - - /** - * Builds a simple unique identifier for this TileEntity by appending the x, y, and z coordinates in a string. - * - * @return unique identifier for this TileEntity |
