diff --git a/src/main/java/mekanism/client/ClientProxy.java b/src/main/java/mekanism/client/ClientProxy.java index d2fe6a353..73aa0f4cb 100644 --- a/src/main/java/mekanism/client/ClientProxy.java +++ b/src/main/java/mekanism/client/ClientProxy.java @@ -335,7 +335,7 @@ public class ClientProxy extends CommonProxy GameRegistry.registerTileEntity(TileEntityInductionPort.class, "InductionPort"); GameRegistry.registerTileEntity(TileEntityInductionCell.class, "InductionCell"); GameRegistry.registerTileEntity(TileEntityInductionProvider.class, "InductionProvider"); - ClientRegistry.registerTileEntity(TileEntityOredictionificator.class, "Oredictionificator", new RenderOredictionificator()); + GameRegistry.registerTileEntity(TileEntityOredictionificator.class, "Oredictionificator"); } @Override diff --git a/src/main/java/mekanism/client/gui/GuiOredictionificator.java b/src/main/java/mekanism/client/gui/GuiOredictionificator.java index affdbf813..3dec2f701 100644 --- a/src/main/java/mekanism/client/gui/GuiOredictionificator.java +++ b/src/main/java/mekanism/client/gui/GuiOredictionificator.java @@ -54,7 +54,7 @@ public class GuiOredictionificator extends GuiMekanism @Override public double getProgress() { - return 1;//tileEntity.isActive ? 1 : 0; + return tileEntity.didProcess ? 1 : 0; } }, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiOredictionificator.png"), 62, 118)); guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiOredictionificator.png"), 25, 114)); diff --git a/src/main/java/mekanism/client/render/block/MachineRenderingHandler.java b/src/main/java/mekanism/client/render/block/MachineRenderingHandler.java index fdd834059..d0e3a8025 100644 --- a/src/main/java/mekanism/client/render/block/MachineRenderingHandler.java +++ b/src/main/java/mekanism/client/render/block/MachineRenderingHandler.java @@ -80,7 +80,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png")); electricPump.render(0.0560F); } - else if(type == MachineType.METALLURGIC_INFUSER || type == MachineType.OREDICTIONIFICATOR/*TODO*/) + else if(type == MachineType.METALLURGIC_INFUSER) { GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F); diff --git a/src/main/java/mekanism/common/block/BlockMachine.java b/src/main/java/mekanism/common/block/BlockMachine.java index ffcaa0e41..c7809c6c7 100644 --- a/src/main/java/mekanism/common/block/BlockMachine.java +++ b/src/main/java/mekanism/common/block/BlockMachine.java @@ -148,6 +148,8 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider; * 2:0: Entangled Block * 2:1: Solar Neutron Activator * 2:2: Ambient Accumulator + * 2:3: Oredictionificator + * * @author AidanBrady * */ @@ -214,6 +216,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer case MACHINE_BLOCK_3: icons[0][0] = register.registerIcon("mekanism:AmbientAccumulator"); icons[2][0] = register.registerIcon("mekanism:SteelCasing"); + icons[3][0] = register.registerIcon("mekanism:OredictionificatorBack"); + icons[3][1] = register.registerIcon("mekanism:OredictionificatorFront"); + icons[3][2] = register.registerIcon("mekanism:OredictionificatorPort"); + icons[3][3] = register.registerIcon("mekanism:OredictionificatorSide"); break; } @@ -382,8 +388,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer if(side == 3) { return icons[meta][0]; - } else - { + } + else { return icons[meta][2]; } case 5: @@ -392,11 +398,12 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer if(side == 3) { return icons[meta][0]; - } else if(side == 0 || side == 1) + } + else if(side == 0 || side == 1) { return icons[meta][2]; - } else - { + } + else { return icons[meta][1]; } default: @@ -410,8 +417,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer if(side == 3) { return icons[meta][0]; - } else - { + } + else { return icons[meta][2]; } default: @@ -422,6 +429,22 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer { default: return icons[meta][0]; + case 3: + if(side == 3) + { + return icons[3][1]; + } + else if(side == 4 || side == 5) + { + return icons[3][2]; + } + else if(side == 2) + { + return icons[3][0]; + } + else { + return icons[3][3]; + } } default: return null; @@ -488,6 +511,22 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer case MACHINE_BLOCK_3: switch(meta) { + case 3: + if(side == tileEntity.facing) + { + return icons[3][1]; + } + else if(side == MekanismUtils.getLeft(tileEntity.facing).ordinal() || side == MekanismUtils.getRight(tileEntity.facing).ordinal()) + { + return icons[3][2]; + } + else if(side == ForgeDirection.OPPOSITES[tileEntity.facing]) + { + return icons[3][0]; + } + else { + return icons[3][3]; + } default: return icons[meta][0]; } @@ -1122,7 +1161,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer ENTANGLED_BLOCK(MachineBlock.MACHINE_BLOCK_3, 0, "EntangledBlock", 46, TileEntityEntangledBlock.class, true, false, false), SOLAR_NEUTRON_ACTIVATOR(MachineBlock.MACHINE_BLOCK_3, 1, "SolarNeutronActivator", 47, TileEntitySolarNeutronActivator.class, false, true, false), AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 2, "AmbientAccumulator", 48, TileEntityAmbientAccumulator.class, true, false, false), - OREDICTIONIFICATOR(MachineBlock.MACHINE_BLOCK_3, 3, "Oredictionificator", 52, TileEntityOredictionificator.class, false, true, false); + OREDICTIONIFICATOR(MachineBlock.MACHINE_BLOCK_3, 3, "Oredictionificator", 52, TileEntityOredictionificator.class, false, false, false); public MachineBlock typeBlock; public int meta; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerOredictionificator.java b/src/main/java/mekanism/common/inventory/container/ContainerOredictionificator.java index bcf2c2c54..cb838b110 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerOredictionificator.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerOredictionificator.java @@ -1,11 +1,15 @@ package mekanism.common.inventory.container; import mekanism.common.inventory.slot.SlotOutput; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.tile.TileEntityOredictionificator; +import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; public class ContainerOredictionificator extends Container { @@ -50,4 +54,80 @@ public class ContainerOredictionificator extends Container { return tileEntity.isUseableByPlayer(entityplayer); } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotID) + { + ItemStack stack = null; + Slot currentSlot = (Slot)inventorySlots.get(slotID); + + if(currentSlot != null && currentSlot.getHasStack()) + { + ItemStack slotStack = currentSlot.getStack(); + stack = slotStack.copy(); + + if(slotID == 1) + { + if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) + { + return null; + } + } + else if(tileEntity.getResult(slotStack) != null) + { + if(slotID != 0 && slotID != 1) + { + if(!mergeItemStack(slotStack, 0, 1, false)) + { + return null; + } + } + else { + if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) + { + return null; + } + } + } + else { + if(slotID >= 2 && slotID <= 28) + { + if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) + { + return null; + } + } + else if(slotID > 28) + { + if(!mergeItemStack(slotStack, 2, 28, false)) + { + return null; + } + } + else { + if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) + { + return null; + } + } + } + + if(slotStack.stackSize == 0) + { + currentSlot.putStack((ItemStack)null); + } + else { + currentSlot.onSlotChanged(); + } + + if(slotStack.stackSize == stack.stackSize) + { + return null; + } + + currentSlot.onPickupFromSlot(player, slotStack); + } + + return stack; + } } diff --git a/src/main/java/mekanism/common/item/ItemBlockMachine.java b/src/main/java/mekanism/common/item/ItemBlockMachine.java index 5b5f03c33..bd36679f0 100644 --- a/src/main/java/mekanism/common/item/ItemBlockMachine.java +++ b/src/main/java/mekanism/common/item/ItemBlockMachine.java @@ -104,6 +104,7 @@ import ic2.api.item.ISpecialElectricItem; * 2:0: Entangled Block * 2:1: Solar Neutron Activator * 2:2: Ambient Accumulator + * 2:3: Oredictionificator * @author AidanBrady * */ diff --git a/src/main/java/mekanism/common/tile/TileEntityOredictionificator.java b/src/main/java/mekanism/common/tile/TileEntityOredictionificator.java index 50f4fd8c6..25da5f6b0 100644 --- a/src/main/java/mekanism/common/tile/TileEntityOredictionificator.java +++ b/src/main/java/mekanism/common/tile/TileEntityOredictionificator.java @@ -36,6 +36,8 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple public RedstoneControl controlType = RedstoneControl.DISABLED; + public boolean didProcess; + public TileEntityOredictionificator() { super(MachineType.OREDICTIONIFICATOR.name); @@ -57,6 +59,8 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple } } + didProcess = false; + if(inventory[0] != null && getValidName(inventory[0]) != null) { ItemStack result = getResult(inventory[0]); @@ -73,6 +77,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple } inventory[1] = result; + didProcess = true; } else if(inventory[0].isItemEqual(result) && inventory[0].stackSize < inventory[0].getMaxStackSize()) { @@ -84,6 +89,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple } inventory[1].stackSize++; + didProcess = true; } markDirty(); @@ -188,6 +194,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple if(type == 0) { controlType = RedstoneControl.values()[dataStream.readInt()]; + didProcess = dataStream.readBoolean(); filters.clear(); @@ -201,6 +208,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple else if(type == 1) { controlType = RedstoneControl.values()[dataStream.readInt()]; + didProcess = dataStream.readBoolean(); } else if(type == 2) { @@ -223,6 +231,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple data.add(0); data.add(controlType.ordinal()); + data.add(didProcess); data.add(filters.size()); @@ -241,6 +250,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple data.add(1); data.add(controlType.ordinal()); + data.add(didProcess); return data; diff --git a/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorBack.png b/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorBack.png new file mode 100644 index 000000000..c00b014d8 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorBack.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorFront.png b/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorFront.png new file mode 100644 index 000000000..54b7378ce Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorFront.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorPort.png b/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorPort.png new file mode 100644 index 000000000..7331844d7 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorPort.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorSide.png b/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorSide.png new file mode 100644 index 000000000..0e8e8c16a Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/OredictionificatorSide.png differ