diff options
| author | kekzdealer <kekzdealer@gmail.com> | 2019-12-10 11:36:39 +0100 |
|---|---|---|
| committer | kekzdealer <kekzdealer@gmail.com> | 2019-12-10 11:36:39 +0100 |
| commit | c7329fe829f69f4585837a5f483dab064d57774f (patch) | |
| tree | 73d512a3afa641f989df2c155949296dbfd383f0 /src | |
| parent | f9eac626254ed31477925618a45af5005e4628ac (diff) | |
| download | GT5-Unofficial-c7329fe829f69f4585837a5f483dab064d57774f.tar.gz GT5-Unofficial-c7329fe829f69f4585837a5f483dab064d57774f.tar.bz2 GT5-Unofficial-c7329fe829f69f4585837a5f483dab064d57774f.zip | |
visiting Lucy~
Diffstat (limited to 'src')
31 files changed, 896 insertions, 460 deletions
diff --git a/src/main/java/blocks/Block_ItemDistributionNode.java b/src/main/java/blocks/Block_ItemDistributionNode.java deleted file mode 100644 index 07fd988445..0000000000 --- a/src/main/java/blocks/Block_ItemDistributionNode.java +++ /dev/null @@ -1,55 +0,0 @@ -package blocks; - -import cpw.mods.fml.common.registry.GameRegistry; -import itemBlocks.IB_ItemDistributionNode; -import kekztech.KekzCore; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import tileentities.TE_ItemDistributionNode; - -public class Block_ItemDistributionNode extends BlockContainer { - - private static Block_ItemDistributionNode instance = new Block_ItemDistributionNode(); - - private Block_ItemDistributionNode() { - super(Material.glass); - } - - public static Block_ItemDistributionNode getInstance() { - return instance; - } - - public void registerBlock() { - final String blockName = "kekztech_itemdistributionnode_block"; - super.setBlockName(blockName); - super.setCreativeTab(CreativeTabs.tabMisc); - super.setBlockTextureName(KekzCore.MODID + ":" + "ItemDistributionNode"); - super.setHardness(3.0f); - super.setResistance(2.0f); - GameRegistry.registerBlock(getInstance(), IB_ItemDistributionNode.class, blockName); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) { - if(world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TE_ItemDistributionNode) { - player.openGui(KekzCore.instance, 0, world, x, y, z); - return true; - } - return false; - } - - @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { - return new TE_ItemDistributionNode(); - } - -} diff --git a/src/main/java/blocks/Block_ItemDistributionCable.java b/src/main/java/blocks/Block_ItemProxyCable.java index 3caefc313a..dee566bab7 100644 --- a/src/main/java/blocks/Block_ItemDistributionCable.java +++ b/src/main/java/blocks/Block_ItemProxyCable.java @@ -1,40 +1,45 @@ package blocks; import cpw.mods.fml.common.registry.GameRegistry; -import itemBlocks.IB_ItemDistributionCable; +import itemBlocks.IB_ItemProxyCable; import kekztech.KekzCore; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import tileentities.TE_ItemDistributionCable; +import tileentities.TE_ItemProxyCable; -public class Block_ItemDistributionCable extends BlockContainer { +public class Block_ItemProxyCable extends BlockContainer { - private static Block_ItemDistributionCable instance = new Block_ItemDistributionCable(); + private static Block_ItemProxyCable instance = new Block_ItemProxyCable(); - private Block_ItemDistributionCable() { + private Block_ItemProxyCable() { super(Material.glass); } - public static Block_ItemDistributionCable getInstance() { + public static Block_ItemProxyCable getInstance() { return instance; } public void registerBlock() { - final String blockName = "kekztech_itemdistributioncable_block"; + final String blockName = "kekztech_itemproxycable_block"; super.setBlockName(blockName); super.setCreativeTab(CreativeTabs.tabMisc); - super.setBlockTextureName(KekzCore.MODID + ":" + "ItemDistributionCable"); + super.setBlockTextureName(KekzCore.MODID + ":" + "TFFTCasing"); super.setHardness(3.0f); super.setResistance(2.0f); - GameRegistry.registerBlock(getInstance(), IB_ItemDistributionCable.class, blockName); + GameRegistry.registerBlock(getInstance(), IB_ItemProxyCable.class, blockName); + } + + @Override + public boolean isOpaqueCube() { + return false; } @Override public TileEntity createNewTileEntity(World world, int p_149915_2_) { - return new TE_ItemDistributionCable(); + return new TE_ItemProxyCable(); } } diff --git a/src/main/java/blocks/Block_ItemProxyEndpoint.java b/src/main/java/blocks/Block_ItemProxyEndpoint.java new file mode 100644 index 0000000000..762880c877 --- /dev/null +++ b/src/main/java/blocks/Block_ItemProxyEndpoint.java @@ -0,0 +1,69 @@ +package blocks; + +import java.util.UUID; + +import cpw.mods.fml.common.registry.GameRegistry; +import itemBlocks.IB_ItemProxyEndpoint; +import items.Item_Configurator; +import kekztech.GuiHandler; +import kekztech.KekzCore; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import tileentities.TE_ItemProxyEndpoint; + +public class Block_ItemProxyEndpoint extends BlockContainer { + + private static Block_ItemProxyEndpoint instance = new Block_ItemProxyEndpoint(); + + private Block_ItemProxyEndpoint() { + super(Material.glass); + } + + public static Block_ItemProxyEndpoint getInstance() { + return instance; + } + + public void registerBlock() { + final String blockName = "kekztech_itemproxyendpoint_block"; + super.setBlockName(blockName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setBlockTextureName(KekzCore.MODID + ":" + "ItemProxyEndpoint"); + super.setHardness(3.0f); + super.setResistance(2.0f); + GameRegistry.registerBlock(getInstance(), IB_ItemProxyEndpoint.class, blockName); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) { + if(world.isRemote) { + return true; + } + + final TileEntity te = world.getTileEntity(x, y, z); + if(te != null && te instanceof TE_ItemProxyEndpoint) { + final TE_ItemProxyEndpoint endpoint = (TE_ItemProxyEndpoint) te; + if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof Item_Configurator) { + + final ItemStack held = player.inventory.getCurrentItem(); + if(held.hasTagCompound() && held.getTagCompound().hasKey("config")) { + endpoint.setChannel(UUID.fromString(held.getTagCompound().getString("config"))); + } + } else { + player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_ENDPOINT, world, x, y, z); + } + return true; + } + return false; + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TE_ItemProxyEndpoint(); + } + +}
\ No newline at end of file diff --git a/src/main/java/blocks/Block_ItemProxySource.java b/src/main/java/blocks/Block_ItemProxySource.java new file mode 100644 index 0000000000..b2cdd4a656 --- /dev/null +++ b/src/main/java/blocks/Block_ItemProxySource.java @@ -0,0 +1,69 @@ +package blocks; + +import cpw.mods.fml.common.registry.GameRegistry; +import itemBlocks.IB_ItemProxySource; +import items.Item_Configurator; +import kekztech.GuiHandler; +import kekztech.KekzCore; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import tileentities.TE_ItemProxySource; + +public class Block_ItemProxySource extends BlockContainer { + + private static Block_ItemProxySource instance = new Block_ItemProxySource(); + + private Block_ItemProxySource() { + super(Material.glass); + } + + public static Block_ItemProxySource getInstance() { + return instance; + } + + public void registerBlock() { + final String blockName = "kekztech_itemproxysource_block"; + super.setBlockName(blockName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setBlockTextureName(KekzCore.MODID + ":" + "ItemProxySource"); + super.setHardness(3.0f); + super.setResistance(2.0f); + GameRegistry.registerBlock(getInstance(), IB_ItemProxySource.class, blockName); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) { + if(world.isRemote) { + return true; + } + + final TileEntity te = world.getTileEntity(x, y, z); + if(te != null && te instanceof TE_ItemProxySource) { + final TE_ItemProxySource source = (TE_ItemProxySource) te; + if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof Item_Configurator) { + + final NBTTagCompound configNBT = new NBTTagCompound(); + configNBT.setString("config", source.getChannel().toString()); + final ItemStack held = player.inventory.getCurrentItem(); + held.setTagCompound(configNBT); + + } else { + player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_SOURCE, world, x, y, z); + } + return true; + } + return false; + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TE_ItemProxySource(); + } + +} diff --git a/src/main/java/container/Container_ItemDistributionNode.java b/src/main/java/container/Container_ItemProxyEndpoint.java index 08096bc80f..5718943efe 100644 --- a/src/main/java/container/Container_ItemDistributionNode.java +++ b/src/main/java/container/Container_ItemProxyEndpoint.java @@ -2,25 +2,24 @@ package container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import tileentities.TE_ItemDistributionNode; +import net.minecraft.tileentity.TileEntity; -public class Container_ItemDistributionNode extends Container { +public class Container_ItemProxyEndpoint extends Container { - private final TE_ItemDistributionNode te; + private final IInventory teInventory; private int slotID = 0; - public Container_ItemDistributionNode(TE_ItemDistributionNode te, EntityPlayer player) { - this.te = te; + public Container_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { + this.teInventory = (IInventory) te; - // Networked Storage - for(int i = 0; i < 4; i++) { - for(int j = 0; j < 4; j++) { - super.addSlotToContainer(new Slot(te, slotID++, 18 * j + 20, 19 * i + 20)); - } - } + // Source Slot + addSlotToContainer(new Slot(teInventory, slotID++, 80, 35)); + // Config slot + addSlotToContainer(new Slot(teInventory, slotID++, 100, 35)); //Inventory for (int i = 0; i < 3; i++) { @@ -62,7 +61,8 @@ public class Container_ItemDistributionNode extends Container { @Override public boolean canInteractWith(EntityPlayer player) { - return te.isUseableByPlayer(player); + return teInventory.isUseableByPlayer(player); } } + diff --git a/src/main/java/container/Container_ItemProxySource.java b/src/main/java/container/Container_ItemProxySource.java new file mode 100644 index 0000000000..50facb4bf2 --- /dev/null +++ b/src/main/java/container/Container_ItemProxySource.java @@ -0,0 +1,80 @@ +package container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +public class Container_ItemProxySource extends Container { + + private final IInventory teInventory; + + private int slotID = 0; + + public Container_ItemProxySource(TileEntity te, EntityPlayer player) { + this.teInventory = (IInventory) te; + + // Source Slots + addSlotToContainer(new Slot(teInventory, slotID++, 53, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 62)); + + //Inventory + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 9; j++) { + addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + // Hotbar + for (int i = 0; i < 9; i++) { + addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); + + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); + + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } + + if (stackInSlot.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return teInventory.isUseableByPlayer(player); + } + +} diff --git a/src/main/java/container/Gui_ItemProxyEndpoint.java b/src/main/java/container/Gui_ItemProxyEndpoint.java new file mode 100644 index 0000000000..0fb1b6e05b --- /dev/null +++ b/src/main/java/container/Gui_ItemProxyEndpoint.java @@ -0,0 +1,50 @@ +package container; + +import org.lwjgl.opengl.GL11; + +import kekztech.KekzCore; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +public class Gui_ItemProxyEndpoint extends GuiContainer { + + private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTech1by1.png"); + + private final InventoryPlayer inventory; + private final IInventory te; + + public Gui_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { + super(new Container_ItemProxyEndpoint(te, player)); + inventory = player.inventory; + this.te = (IInventory) te; + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + final int x = (super.width - super.xSize) / 2; + final int y = (super.height - super.ySize) / 2; + + super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int p1, int p2) { + super.fontRendererObj.drawString( + I18n.format(te.getInventoryName()), + (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), + 6, 4210752, false); + super.fontRendererObj.drawString( + I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); + } +} diff --git a/src/main/java/container/Gui_ItemDistributionNode.java b/src/main/java/container/Gui_ItemProxySource.java index 08f530fce8..e72928f7ff 100644 --- a/src/main/java/container/Gui_ItemDistributionNode.java +++ b/src/main/java/container/Gui_ItemProxySource.java @@ -8,20 +8,21 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; -import tileentities.TE_ItemDistributionNode; -public class Gui_ItemDistributionNode extends GuiContainer { +public class Gui_ItemProxySource extends GuiContainer { - private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemDistributionNode.png"); + private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTech4by4.png"); private final InventoryPlayer inventory; - private final TE_ItemDistributionNode te; + private final IInventory te; - public Gui_ItemDistributionNode(TE_ItemDistributionNode te, EntityPlayer player) { - super(new Container_ItemDistributionNode(te, player)); + public Gui_ItemProxySource(TileEntity te, EntityPlayer player) { + super(new Container_ItemProxySource(te, player)); inventory = player.inventory; - this.te = te; + this.te = (IInventory) te; } diff --git a/src/main/java/itemBlocks/IB_ItemDistributionCable.java b/src/main/java/itemBlocks/IB_ItemProxyCable.java index 832e95ca0a..590cb98285 100644 --- a/src/main/java/itemBlocks/IB_ItemDistributionCable.java +++ b/src/main/java/itemBlocks/IB_ItemProxyCable.java @@ -7,9 +7,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class IB_ItemDistributionCable extends ItemBlock { +public class IB_ItemProxyCable extends ItemBlock { - public IB_ItemDistributionCable(Block block) { + public IB_ItemProxyCable(Block block) { super(block); } diff --git a/src/main/java/itemBlocks/IB_ItemDistributionNode.java b/src/main/java/itemBlocks/IB_ItemProxyEndpoint.java index cfea3853db..90d683c226 100644 --- a/src/main/java/itemBlocks/IB_ItemDistributionNode.java +++ b/src/main/java/itemBlocks/IB_ItemProxyEndpoint.java @@ -7,16 +7,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class IB_ItemDistributionNode extends ItemBlock { +public class IB_ItemProxyEndpoint extends ItemBlock { - public IB_ItemDistributionNode(Block block) { + public IB_ItemProxyEndpoint(Block block) { super(block); } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add("Access point for Item Distribution Networks"); - lines.add("Wired networks do not require a controller"); + lines.add("Point the marked side to where you want to provide an inventory proxy to."); + lines.add("Insert an Integrated Circuit to set the network channel."); } } diff --git a/src/main/java/itemBlocks/IB_ItemProxySource.java b/src/main/java/itemBlocks/IB_ItemProxySource.java new file mode 100644 index 0000000000..cc937b3b33 --- /dev/null +++ b/src/main/java/itemBlocks/IB_ItemProxySource.java @@ -0,0 +1,23 @@ +package itemBlocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class IB_ItemProxySource extends ItemBlock { + + public IB_ItemProxySource(Block block) { + super(block); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add("Point to an inventory to act as source for the item proxy network."); + lines.add("Insert an Integrated Circuit to set the network channel."); + lines.add("Only one source can use one channel on the same network."); + } +} diff --git a/src/main/java/items/Item_Configurator.java b/src/main/java/items/Item_Configurator.java new file mode 100644 index 0000000000..ed319eb37e --- /dev/null +++ b/src/main/java/items/Item_Configurator.java @@ -0,0 +1,43 @@ +package items; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class Item_Configurator extends Item { + + private static final Item_Configurator instance = new Item_Configurator(); + + private Item_Configurator() { + // I am a singleton + } + + public static Item_Configurator getInstance() { + return instance; + } + + public void registerItem() { + super.setHasSubtypes(false); + final String unlocalizedName = "kekztech_configurator"; + super.setUnlocalizedName(unlocalizedName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setMaxStackSize(1); + super.setTextureName(KekzCore.MODID + ":" + "DiamondHeatPipe"); + GameRegistry.registerItem(getInstance(), unlocalizedName); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { + list.add("Used to configure Item Proxy Networks"); + if(stack.hasTagCompound() && stack.getTagCompound().hasKey("config")) { + list.add("Channel: " + stack.getTagCompound().getString("config")); + } + } + +} diff --git a/src/main/java/kekztech/GuiHandler.java b/src/main/java/kekztech/GuiHandler.java index 21ad5c95ae..439baff31f 100644 --- a/src/main/java/kekztech/GuiHandler.java +++ b/src/main/java/kekztech/GuiHandler.java @@ -1,21 +1,26 @@ package kekztech; -import container.Container_ItemDistributionNode; -import container.Gui_ItemDistributionNode; +import container.Container_ItemProxyEndpoint; +import container.Container_ItemProxySource; +import container.Gui_ItemProxyEndpoint; +import container.Gui_ItemProxySource; import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import tileentities.TE_ItemDistributionNode; public class GuiHandler implements IGuiHandler { - + + public static final int ITEM_PROXY_SOURCE = 0; + public static final int ITEM_PROXY_ENDPOINT = 1; + @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { final TileEntity te = world.getTileEntity(x, y, z); if(te != null) { - if(ID == 0) { - return new Container_ItemDistributionNode((TE_ItemDistributionNode) te, player); + switch(ID) { + case ITEM_PROXY_SOURCE: return new Container_ItemProxySource(te, player); + case ITEM_PROXY_ENDPOINT: return new Container_ItemProxyEndpoint(te, player); } } return null; @@ -25,8 +30,9 @@ public class GuiHandler implements IGuiHandler { public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { final TileEntity te = world.getTileEntity(x, y, z); if(te != null) { - if(ID == 0) { - return new Gui_ItemDistributionNode((TE_ItemDistributionNode) te, player); + switch(ID) { + case ITEM_PROXY_SOURCE: return new Gui_ItemProxySource(te, player); + case ITEM_PROXY_ENDPOINT: return new Gui_ItemProxyEndpoint(te, player); } } return null; diff --git a/src/main/java/kekztech/IConduit.java b/src/main/java/kekztech/IConduit.java deleted file mode 100644 index ce726a2207..0000000000 --- a/src/main/java/kekztech/IConduit.java +++ /dev/null @@ -1,8 +0,0 @@ -package kekztech; - -public interface IConduit { - - public void setNetwork(ItemDistributionNetworkController network); - public ItemDistributionNetworkController getNetwork(); - -} diff --git a/src/main/java/kekztech/ItemDistributionNetworkController.java b/src/main/java/kekztech/ItemDistributionNetworkController.java deleted file mode 100644 index 11383845b2..0000000000 --- a/src/main/java/kekztech/ItemDistributionNetworkController.java +++ /dev/null @@ -1,193 +0,0 @@ -package kekztech; - -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.UUID; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class ItemDistributionNetworkController implements Comparable<ItemDistributionNetworkController> { - - private static final HashSet<ItemDistributionNetworkController> instances = new HashSet<>(); - - private final UUID uuid = UUID.randomUUID(); - private final LinkedList<IConduit> conduits = new LinkedList<>(); - private final boolean[] slotDirections = new boolean[15]; - private final ItemStack[] networkedItemStacks = new ItemStack[15]; - //private final HashMap<String, IConduit> sources = new HashMap<>(); // k = resource name, v = source conduit - - public ItemDistributionNetworkController() { - - } - - /** - * Places a new conduit as it's own network. Merges with adjacent networks automatically. - * - * @param conduit - * The conduit to be placed - */ - public static void placeConduit(IConduit conduit) { - - conduit.setNetwork(new ItemDistributionNetworkController()); - conduit.getNetwork().addConduit(conduit); - /* - final TileEntity te = (TileEntity) conduit; - final int x = te.xCoord; - final int y = te.yCoord; - final int z = te.zCoord; - - // Search for adjacent Networks on all six sides - final HashSet<ItemDistributionNetworkController> networks = new HashSet<>(); - final World world = te.getWorldObj(); - final TileEntity te1x = world.getTileEntity(x + 1, y, z); - final TileEntity te0x = world.getTileEntity(x - 1, y, z); - final TileEntity te1y = world.getTileEntity(x, y + 1, z); - final TileEntity te0y = world.getTileEntity(x, y - 1, z); - final TileEntity te1z = world.getTileEntity(x, y, z + 1); - final TileEntity te0z = world.getTileEntity(x, y, z - 1); - if(te1x != null && |
