diff --git a/common/mekanism/client/ClientProxy.java b/common/mekanism/client/ClientProxy.java index 1c06d0172..a36828231 100644 --- a/common/mekanism/client/ClientProxy.java +++ b/common/mekanism/client/ClientProxy.java @@ -53,6 +53,7 @@ import mekanism.client.render.tileentity.RenderMechanicalPipe; import mekanism.client.render.tileentity.RenderMetallurgicInfuser; import mekanism.client.render.tileentity.RenderObsidianTNT; import mekanism.client.render.tileentity.RenderPressurizedTube; +import mekanism.client.render.tileentity.RenderRotaryCondensentrator; import mekanism.client.render.tileentity.RenderUniversalCable; import mekanism.client.sound.Sound; import mekanism.client.sound.SoundHandler; @@ -91,6 +92,7 @@ import mekanism.common.tileentity.TileEntityObsidianTNT; import mekanism.common.tileentity.TileEntityOsmiumCompressor; import mekanism.common.tileentity.TileEntityPressurizedTube; import mekanism.common.tileentity.TileEntityPurificationChamber; +import mekanism.common.tileentity.TileEntityRotaryCondensentrator; import mekanism.common.tileentity.TileEntityTeleporter; import mekanism.common.tileentity.TileEntityUniversalCable; import net.minecraft.client.Minecraft; @@ -251,6 +253,7 @@ public class ClientProxy extends CommonProxy ClientRegistry.registerTileEntity(TileEntityLogisticalSorter.class, "LogisticalSorter", new RenderLogisticalSorter()); ClientRegistry.registerTileEntity(TileEntityBin.class, "Bin", new RenderBin()); ClientRegistry.registerTileEntity(TileEntityDigitalMiner.class, "DigitalMiner", new RenderDigitalMiner()); + ClientRegistry.registerTileEntity(TileEntityRotaryCondensentrator.class, "RotaryCondensentrator", new RenderRotaryCondensentrator()); } @Override @@ -299,6 +302,8 @@ public class ClientProxy extends CommonProxy return new GuiCombiner(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); case 6: return new GuiCrusher(player.inventory, (TileEntityElectricMachine)tileEntity); + case 7: + //return new GuiRotaryCondensentrator(player.inventory, (TileEntityRotaryCondensentrator)tileEntity); TODO case 8: return new GuiEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity); case 9: diff --git a/common/mekanism/client/model/ModelRotaryCondensentrator.java b/common/mekanism/client/model/ModelRotaryCondensentrator.java new file mode 100644 index 000000000..c52693ee9 --- /dev/null +++ b/common/mekanism/client/model/ModelRotaryCondensentrator.java @@ -0,0 +1,229 @@ +package mekanism.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelRotaryCondensentrator extends ModelBase +{ + ModelRenderer GasBottleLid1; + ModelRenderer GasBottleLid2; + ModelRenderer GasBottleDecor1; + ModelRenderer GasBottleDecor2; + ModelRenderer GasBottleDecor3; + ModelRenderer GasBottleDecor4; + ModelRenderer GasBottle1; + ModelRenderer GasBottle2; + ModelRenderer GasBottleBot1; + ModelRenderer GasBottleBot2; + ModelRenderer LiqBottleLid1; + ModelRenderer LiqBottleLid2; + ModelRenderer LiqBottleBot1; + ModelRenderer LiqBottleBot2; + ModelRenderer LiqBottle2; + ModelRenderer LiqBottle1; + ModelRenderer LiqBottleDecor1; + ModelRenderer LiqBottleDecor2; + ModelRenderer LiqBottleDecor3; + ModelRenderer LiqBottleDecor4; + ModelRenderer GasInput; + ModelRenderer MidSection1; + ModelRenderer MidSection2; + ModelRenderer LiquidOutput; + ModelRenderer MidSection3; + + public ModelRotaryCondensentrator() + { + textureWidth = 128; + textureHeight = 128; + + GasBottleLid1 = new ModelRenderer(this, 0, 40); + GasBottleLid1.addBox(0F, 0F, 0F, 6, 1, 6); + GasBottleLid1.setRotationPoint(-7F, 11F, 1F); + GasBottleLid1.setTextureSize(128, 128); + GasBottleLid1.mirror = true; + setRotation(GasBottleLid1, 0F, 0F, 0F); + GasBottleLid2 = new ModelRenderer(this, 0, 40); + GasBottleLid2.addBox(0F, 0F, 0F, 6, 1, 6); + GasBottleLid2.setRotationPoint(1F, 11F, 1F); + GasBottleLid2.setTextureSize(128, 128); + GasBottleLid2.mirror = true; + setRotation(GasBottleLid2, 0F, 0F, 0F); + GasBottleDecor1 = new ModelRenderer(this, 0, 33); + GasBottleDecor1.addBox(0F, 0F, 0F, 5, 1, 5); + GasBottleDecor1.setRotationPoint(1.5F, 21F, 1.5F); + GasBottleDecor1.setTextureSize(128, 128); + GasBottleDecor1.mirror = true; + setRotation(GasBottleDecor1, 0F, 0F, 0F); + GasBottleDecor2 = new ModelRenderer(this, 0, 33); + GasBottleDecor2.addBox(0F, 0F, 0F, 5, 1, 5); + GasBottleDecor2.setRotationPoint(1.5F, 13F, 1.5F); + GasBottleDecor2.setTextureSize(128, 128); + GasBottleDecor2.mirror = true; + setRotation(GasBottleDecor2, 0F, 0F, 0F); + GasBottleDecor3 = new ModelRenderer(this, 0, 33); + GasBottleDecor3.addBox(0F, 0F, 0F, 5, 1, 5); + GasBottleDecor3.setRotationPoint(-6.5F, 21F, 1.5F); + GasBottleDecor3.setTextureSize(128, 128); + GasBottleDecor3.mirror = true; + setRotation(GasBottleDecor3, 0F, 0F, 0F); + GasBottleDecor4 = new ModelRenderer(this, 0, 33); + GasBottleDecor4.addBox(0F, 0F, 0F, 5, 1, 5); + GasBottleDecor4.setRotationPoint(-6.5F, 13F, 1.5F); + GasBottleDecor4.setTextureSize(128, 128); + GasBottleDecor4.mirror = true; + setRotation(GasBottleDecor4, 0F, 0F, 0F); + GasBottle1 = new ModelRenderer(this, 0, 48); + GasBottle1.addBox(0F, 0F, 0F, 4, 11, 4); + GasBottle1.setRotationPoint(-6F, 12F, 2F); + GasBottle1.setTextureSize(128, 128); + GasBottle1.mirror = true; + setRotation(GasBottle1, 0F, 0F, 0F); + GasBottle2 = new ModelRenderer(this, 0, 48); + GasBottle2.addBox(0F, 0F, 0F, 4, 11, 4); + GasBottle2.setRotationPoint(2F, 12F, 2F); + GasBottle2.setTextureSize(128, 128); + GasBottle2.mirror = true; + setRotation(GasBottle2, 0F, 0F, 0F); + GasBottleBot1 = new ModelRenderer(this, 0, 40); + GasBottleBot1.addBox(0F, 0F, 0F, 6, 1, 6); + GasBottleBot1.setRotationPoint(-7F, 23F, 1F); + GasBottleBot1.setTextureSize(128, 128); + GasBottleBot1.mirror = true; + setRotation(GasBottleBot1, 0F, 0F, 0F); + GasBottleBot2 = new ModelRenderer(this, 0, 40); + GasBottleBot2.addBox(0F, 0F, 0F, 6, 1, 6); + GasBottleBot2.setRotationPoint(1F, 23F, 1F); + GasBottleBot2.setTextureSize(128, 128); + GasBottleBot2.mirror = true; + setRotation(GasBottleBot2, 0F, 0F, 0F); + LiqBottleLid1 = new ModelRenderer(this, 25, 40); + LiqBottleLid1.addBox(0F, 0F, 0F, 6, 1, 6); + LiqBottleLid1.setRotationPoint(-7F, 11F, -7F); + LiqBottleLid1.setTextureSize(128, 128); + LiqBottleLid1.mirror = true; + setRotation(LiqBottleLid1, 0F, 0F, 0F); + LiqBottleLid2 = new ModelRenderer(this, 25, 40); + LiqBottleLid2.addBox(0F, 0F, 0F, 6, 1, 6); + LiqBottleLid2.setRotationPoint(1F, 11F, -7F); + LiqBottleLid2.setTextureSize(128, 128); + LiqBottleLid2.mirror = true; + setRotation(LiqBottleLid2, 0F, 0F, 0F); + LiqBottleBot1 = new ModelRenderer(this, 25, 40); + LiqBottleBot1.addBox(0F, 0F, 0F, 6, 1, 6); + LiqBottleBot1.setRotationPoint(-7F, 23F, -7F); + LiqBottleBot1.setTextureSize(128, 128); + LiqBottleBot1.mirror = true; + setRotation(LiqBottleBot1, 0F, 0F, 0F); + LiqBottleBot2 = new ModelRenderer(this, 25, 40); + LiqBottleBot2.addBox(0F, 0F, 0F, 6, 1, 6); + LiqBottleBot2.setRotationPoint(1F, 23F, -7F); + LiqBottleBot2.setTextureSize(128, 128); + LiqBottleBot2.mirror = true; + setRotation(LiqBottleBot2, 0F, 0F, 0F); + LiqBottle2 = new ModelRenderer(this, 25, 48); + LiqBottle2.addBox(0F, 0F, 0F, 4, 11, 4); + LiqBottle2.setRotationPoint(2F, 12F, -6F); + LiqBottle2.setTextureSize(128, 128); + LiqBottle2.mirror = true; + setRotation(LiqBottle2, 0F, 0F, 0F); + LiqBottle1 = new ModelRenderer(this, 25, 48); + LiqBottle1.addBox(0F, 0F, 0F, 4, 11, 4); + LiqBottle1.setRotationPoint(-6F, 12F, -6F); + LiqBottle1.setTextureSize(128, 128); + LiqBottle1.mirror = true; + setRotation(LiqBottle1, 0F, 0F, 0F); + LiqBottleDecor1 = new ModelRenderer(this, 25, 33); + LiqBottleDecor1.addBox(0F, 0F, 0F, 5, 1, 5); + LiqBottleDecor1.setRotationPoint(1.5F, 21F, -6.5F); + LiqBottleDecor1.setTextureSize(128, 128); + LiqBottleDecor1.mirror = true; + setRotation(LiqBottleDecor1, 0F, 0F, 0F); + LiqBottleDecor2 = new ModelRenderer(this, 25, 33); + LiqBottleDecor2.addBox(0F, 0F, 0F, 5, 1, 5); + LiqBottleDecor2.setRotationPoint(1.5F, 13F, -6.5F); + LiqBottleDecor2.setTextureSize(128, 128); + LiqBottleDecor2.mirror = true; + setRotation(LiqBottleDecor2, 0F, 0F, 0F); + LiqBottleDecor3 = new ModelRenderer(this, 25, 33); + LiqBottleDecor3.addBox(0F, 0F, 0F, 5, 1, 5); + LiqBottleDecor3.setRotationPoint(-6.5F, 21F, -6.5F); + LiqBottleDecor3.setTextureSize(128, 128); + LiqBottleDecor3.mirror = true; + setRotation(LiqBottleDecor3, 0F, 0F, 0F); + LiqBottleDecor4 = new ModelRenderer(this, 25, 33); + LiqBottleDecor4.addBox(0F, 0F, 0F, 5, 1, 5); + LiqBottleDecor4.setRotationPoint(-6.5F, 13F, -6.5F); + LiqBottleDecor4.setTextureSize(128, 128); + LiqBottleDecor4.mirror = true; + setRotation(LiqBottleDecor4, 0F, 0F, 0F); + GasInput = new ModelRenderer(this, 0, 24); + GasInput.addBox(0F, 0F, 0F, 6, 6, 1); + GasInput.setRotationPoint(-3F, 13F, 7F); + GasInput.setTextureSize(128, 128); + GasInput.mirror = true; + setRotation(GasInput, 0F, 0F, 0F); + MidSection1 = new ModelRenderer(this, 15, 20); + MidSection1.addBox(0F, 0F, 0F, 4, 5, 6); + MidSection1.setRotationPoint(-2F, 18F, 1F); + MidSection1.setTextureSize(128, 128); + MidSection1.mirror = true; + setRotation(MidSection1, 0F, 0F, 0F); + MidSection2 = new ModelRenderer(this, 37, 0); + MidSection2.addBox(0F, 0F, 0F, 6, 7, 8); + MidSection2.setRotationPoint(-3F, 17F, -7F); + MidSection2.setTextureSize(128, 128); + MidSection2.mirror = true; + setRotation(MidSection2, 0F, 0F, 0F); + LiquidOutput = new ModelRenderer(this, 36, 22); + LiquidOutput.addBox(0F, 0F, 0F, 8, 8, 1); + LiquidOutput.setRotationPoint(-4F, 12F, -8F); + LiquidOutput.setTextureSize(128, 128); + LiquidOutput.mirror = true; + setRotation(LiquidOutput, 0F, 0F, 0F); + MidSection3 = new ModelRenderer(this, 0, 0); + MidSection3.addBox(0F, 0F, 0F, 4, 2, 14); + MidSection3.setRotationPoint(-2F, 15F, -7F); + MidSection3.setTextureSize(128, 128); + MidSection3.mirror = true; + setRotation(MidSection3, 0F, 0F, 0F); + } + + public void render(float size) + { + GasBottleLid1.render(size); + GasBottleLid2.render(size); + GasBottleDecor1.render(size); + GasBottleDecor2.render(size); + GasBottleDecor3.render(size); + GasBottleDecor4.render(size); + GasBottle1.render(size); + GasBottle2.render(size); + GasBottleBot1.render(size); + GasBottleBot2.render(size); + LiqBottleLid1.render(size); + LiqBottleLid2.render(size); + LiqBottleBot1.render(size); + LiqBottleBot2.render(size); + LiqBottle2.render(size); + LiqBottle1.render(size); + LiqBottleDecor1.render(size); + LiqBottleDecor2.render(size); + LiqBottleDecor3.render(size); + LiqBottleDecor4.render(size); + GasInput.render(size); + MidSection1.render(size); + MidSection2.render(size); + LiquidOutput.render(size); + MidSection3.render(size); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/common/mekanism/client/render/block/MachineRenderingHandler.java b/common/mekanism/client/render/block/MachineRenderingHandler.java index 4ea7d1047..49ec3a3e4 100644 --- a/common/mekanism/client/render/block/MachineRenderingHandler.java +++ b/common/mekanism/client/render/block/MachineRenderingHandler.java @@ -6,6 +6,7 @@ import mekanism.client.model.ModelDigitalMiner; import mekanism.client.model.ModelElectricPump; import mekanism.client.model.ModelLogisticalSorter; import mekanism.client.model.ModelMetallurgicInfuser; +import mekanism.client.model.ModelRotaryCondensentrator; import mekanism.client.render.MekanismRenderer; import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.util.MekanismUtils; @@ -29,6 +30,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler public ModelChargepad chargepad = new ModelChargepad(); public ModelLogisticalSorter logisticalSorter = new ModelLogisticalSorter(); public ModelDigitalMiner digitalMiner = new ModelDigitalMiner(); + public ModelRotaryCondensentrator rotaryCondensentrator = new ModelRotaryCondensentrator(); @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) @@ -80,6 +82,14 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "DigitalMiner.png")); digitalMiner.render(0.03125F, false); } + else if(MachineType.get(block.blockID, metadata) == MachineType.ROTARY_CONDENSENTRATOR) + { + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1F, -0.05F); + Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "RotaryCondensentrator.png")); + rotaryCondensentrator.render(0.0625F); + } else { MekanismRenderer.renderItem(renderer, metadata, block); } diff --git a/common/mekanism/client/render/tileentity/RenderRotaryCondensentrator.java b/common/mekanism/client/render/tileentity/RenderRotaryCondensentrator.java new file mode 100644 index 000000000..7b4073f2f --- /dev/null +++ b/common/mekanism/client/render/tileentity/RenderRotaryCondensentrator.java @@ -0,0 +1,44 @@ +package mekanism.client.render.tileentity; + +import org.lwjgl.opengl.GL11; + +import mekanism.client.model.ModelRotaryCondensentrator; +import mekanism.common.tileentity.TileEntityRotaryCondensentrator; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderRotaryCondensentrator extends TileEntitySpecialRenderer +{ + private ModelRotaryCondensentrator model = new ModelRotaryCondensentrator(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) + { + renderAModelAt((TileEntityRotaryCondensentrator)tileEntity, x, y, z, partialTick); + } + + private void renderAModelAt(TileEntityRotaryCondensentrator tileEntity, double x, double y, double z, float partialTick) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); + + bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "RotaryCondensentrator.png")); + + switch(tileEntity.facing) + { + case 2: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break; + case 3: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break; + case 4: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break; + case 5: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break; + } + + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + model.render(0.0625F); + GL11.glPopMatrix(); + } +} diff --git a/common/mekanism/common/CommonProxy.java b/common/mekanism/common/CommonProxy.java index 405d909cb..7d987f7d8 100644 --- a/common/mekanism/common/CommonProxy.java +++ b/common/mekanism/common/CommonProxy.java @@ -47,6 +47,7 @@ import mekanism.common.tileentity.TileEntityObsidianTNT; import mekanism.common.tileentity.TileEntityOsmiumCompressor; import mekanism.common.tileentity.TileEntityPressurizedTube; import mekanism.common.tileentity.TileEntityPurificationChamber; +import mekanism.common.tileentity.TileEntityRotaryCondensentrator; import mekanism.common.tileentity.TileEntityTeleporter; import mekanism.common.tileentity.TileEntityUniversalCable; import net.minecraft.entity.player.EntityPlayer; @@ -97,6 +98,7 @@ public class CommonProxy GameRegistry.registerTileEntity(TileEntityBin.class, "Bin"); GameRegistry.registerTileEntity(TileEntityDigitalMiner.class, "DigitalMiner"); GameRegistry.registerTileEntity(TileEntityObsidianTNT.class, "ObsidianTNT"); + GameRegistry.registerTileEntity(TileEntityRotaryCondensentrator.class, "RotaryCondensentrator"); } /** @@ -261,7 +263,7 @@ public class CommonProxy case 6: return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity); case 7: - return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); + //return new ContainerRotaryCondensentrator(player.inventory, (TileEntityRotaryCondensentrator)tileEntity); TODO case 8: return new ContainerEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity); case 9: diff --git a/common/mekanism/common/EnergyNetwork.java b/common/mekanism/common/EnergyNetwork.java index 37f769bec..ab7066151 100644 --- a/common/mekanism/common/EnergyNetwork.java +++ b/common/mekanism/common/EnergyNetwork.java @@ -24,7 +24,6 @@ import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event; import universalelectricity.core.block.IElectrical; -import universalelectricity.core.electricity.ElectricityDisplay; import universalelectricity.core.electricity.ElectricityPack; import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.PowerHandler.PowerReceiver; @@ -131,7 +130,7 @@ public class EnergyNetwork extends DynamicNetwork prevEnergy = energyToSend; sent = 0; - energyToSend = doEmit(energyToSend, ignored); + energyToSend -= (energyToSend - doEmit(energyToSend, ignored)); sent = prevEnergy-energyToSend; if(energyToSend > 0 && sent > 0) @@ -143,6 +142,9 @@ public class EnergyNetwork extends DynamicNetwork return energyToSend; } + /** + * @return rejects + */ public synchronized double doEmit(double energyToSend, ArrayList ignored) { double energyAvailable = energyToSend; @@ -180,7 +182,8 @@ public class EnergyNetwork extends DynamicNetwork } else if(acceptor instanceof IEnergySink) { - double toSend = Math.min(currentSending, (((IEnergySink)acceptor).getMaxSafeInput()*Mekanism.FROM_IC2)); + double toSend = Math.min(currentSending, ((IEnergySink)acceptor).getMaxSafeInput()*Mekanism.FROM_IC2); + toSend = Math.min(toSend, ((IEnergySink)acceptor).demandedEnergyUnits()*Mekanism.FROM_IC2); energyToSend -= (toSend - (((IEnergySink)acceptor).injectEnergyUnits(side.getOpposite(), toSend*Mekanism.TO_IC2)*Mekanism.FROM_IC2)); } else if(acceptor instanceof IPowerReceptor && MekanismUtils.useBuildcraft()) @@ -440,12 +443,12 @@ public class EnergyNetwork extends DynamicNetwork @Override public String getNeeded() { - return ElectricityDisplay.getDisplay((float)(getEnergyNeeded(new ArrayList())*Mekanism.TO_UE), ElectricityDisplay.ElectricUnit.JOULES); + return MekanismUtils.getEnergyDisplay(getEnergyNeeded(new ArrayList())); } @Override public String getFlow() { - return ElectricityDisplay.getDisplay((float)(getPower()*Mekanism.TO_UE), ElectricityDisplay.ElectricUnit.JOULES); + return MekanismUtils.getEnergyDisplay(getPower()); } } diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index 314f66e45..c3a0f3bda 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -435,6 +435,10 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Transmitter, 1, 4), new Object[] { "RRR", "SBS", "RRR", Character.valueOf('R'), Item.redstone, Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Block.fenceIron })); + CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock2, 1, 0), new Object[] { + "GCG", "tET", "GIG", Character.valueOf('G'), Block.glass, Character.valueOf('C'), "circuitBasic", Character.valueOf('t'), MekanismUtils.getEmptyGasTank(), Character.valueOf('E'), EnergyTablet.getUnchargedItem(), + Character.valueOf('T'), new ItemStack(BasicBlock, 1, 9), Character.valueOf('I'), new ItemStack(BasicBlock, 1, 8) + })); for(RecipeType type : RecipeType.values()) { diff --git a/common/mekanism/common/block/BlockMachine.java b/common/mekanism/common/block/BlockMachine.java index 7ca236006..9e876bd57 100644 --- a/common/mekanism/common/block/BlockMachine.java +++ b/common/mekanism/common/block/BlockMachine.java @@ -21,7 +21,6 @@ import mekanism.common.ItemAttacher; import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.PacketHandler.Transmission; -import mekanism.common.Tier.FactoryTier; import mekanism.common.miner.MinerFilter; import mekanism.common.network.PacketElectricChest; import mekanism.common.network.PacketElectricChest.ElectricChestPacketType; @@ -45,6 +44,7 @@ import mekanism.common.tileentity.TileEntityLogisticalSorter; import mekanism.common.tileentity.TileEntityMetallurgicInfuser; import mekanism.common.tileentity.TileEntityOsmiumCompressor; import mekanism.common.tileentity.TileEntityPurificationChamber; +import mekanism.common.tileentity.TileEntityRotaryCondensentrator; import mekanism.common.tileentity.TileEntityTeleporter; import mekanism.common.transporter.TransporterFilter; import mekanism.common.util.MekanismUtils; @@ -1010,7 +1010,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds ELECTRIC_PUMP(Mekanism.machineBlockID, 12, "ElectricPump", 17, 10000, TileEntityElectricPump.class, true), ELECTRIC_CHEST(Mekanism.machineBlockID, 13, "ElectricChest", -1, 12000, TileEntityElectricChest.class, true), CHARGEPAD(Mekanism.machineBlockID, 14, "Chargepad", -1, 10000, TileEntityChargepad.class, true), - LOGISTICAL_SORTER(Mekanism.machineBlockID, 15, "LogisticalSorter", -1, 0, TileEntityLogisticalSorter.class, true); + LOGISTICAL_SORTER(Mekanism.machineBlockID, 15, "LogisticalSorter", -1, 0, TileEntityLogisticalSorter.class, true), + ROTARY_CONDENSENTRATOR(Mekanism.machineBlock2ID, 0, "RotaryCondensentrator", 7, 20000, TileEntityRotaryCondensentrator.class, true); public int typeId; public int meta; diff --git a/common/mekanism/common/inventory/container/ContainerRotaryCondensentrator.java b/common/mekanism/common/inventory/container/ContainerRotaryCondensentrator.java new file mode 100644 index 000000000..3f216ecf9 --- /dev/null +++ b/common/mekanism/common/inventory/container/ContainerRotaryCondensentrator.java @@ -0,0 +1,126 @@ +package mekanism.common.inventory.container; + +import mekanism.common.inventory.slot.SlotOutput; +import mekanism.common.inventory.slot.SlotStorageTank; +import mekanism.common.tileentity.TileEntityRotaryCondensentrator; +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; +import net.minecraftforge.fluids.FluidContainerRegistry; + +public class ContainerRotaryCondensentrator extends Container +{ + private TileEntityRotaryCondensentrator tileEntity; + + public ContainerRotaryCondensentrator(InventoryPlayer inventory, TileEntityRotaryCondensentrator tentity) + { + tileEntity = tentity; + addSlotToContainer(new SlotStorageTank(tentity, null, true, 0, 8, 8)); + addSlotToContainer(new SlotStorageTank(tentity, null, true, 1, 8, 40)); + addSlotToContainer(new Slot(tentity, 0, 146, 20)); + addSlotToContainer(new SlotOutput(tentity, 1, 146, 51)); + int slotX; + + for(slotX = 0; slotX < 3; ++slotX) + { + for(int slotY = 0; slotY < 9; ++slotY) + { + addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18)); + } + } + + for(slotX = 0; slotX < 9; ++slotX) + { + addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142)); + } + + tileEntity.playersUsing.add(inventory.player); + tileEntity.openChest(); + } + + @Override + public void onContainerClosed(EntityPlayer entityplayer) + { + super.onContainerClosed(entityplayer); + + tileEntity.playersUsing.remove(entityplayer); + tileEntity.closeChest(); + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) + { + 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(FluidContainerRegistry.isEmptyContainer(slotStack) || FluidContainerRegistry.isFilledContainer(slotStack)) + { + 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 <= 8) + { + 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/common/mekanism/common/item/ItemBlockMachine.java b/common/mekanism/common/item/ItemBlockMachine.java index 76caa214f..4b9509214 100644 --- a/common/mekanism/common/item/ItemBlockMachine.java +++ b/common/mekanism/common/item/ItemBlockMachine.java @@ -100,9 +100,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem @Override public String getUnlocalizedName(ItemStack itemstack) { - if(MachineType.get(itemstack.itemID, itemstack.getItemDamage()) != null) + if(MachineType.get(itemstack) != null) { - return getUnlocalizedName() + "." + MachineType.get(itemstack.itemID, itemstack.getItemDamage()).name; + return getUnlocalizedName() + "." + MachineType.get(itemstack).name; } return "null"; diff --git a/common/mekanism/common/tileentity/TileEntityElectricBlock.java b/common/mekanism/common/tileentity/TileEntityElectricBlock.java index 3f36b1bcd..15966ee0c 100644 --- a/common/mekanism/common/tileentity/TileEntityElectricBlock.java +++ b/common/mekanism/common/tileentity/TileEntityElectricBlock.java @@ -3,7 +3,6 @@ package mekanism.common.tileentity; import ic2.api.energy.event.EnergyTileLoadEvent; import ic2.api.energy.event.EnergyTileUnloadEvent; import ic2.api.energy.tile.IEnergySink; -import ic2.api.energy.tile.IEnergySource; import ic2.api.energy.tile.IEnergyTile; import ic2.api.tile.IEnergyStorage; import ic2.api.tile.IWrenchable; @@ -34,7 +33,7 @@ import cofh.api.energy.IEnergyHandler; import com.google.common.io.ByteArrayDataInput; -public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements IWrenchable, ITileNetwork, IPowerReceptor, IEnergyTile, IElectrical, IElectricalStorage, IConnector, IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergySource, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter +public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements IWrenchable, ITileNetwork, IPowerReceptor, IEnergyTile, IElectrical, IElectricalStorage, IConnector, IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter { /** How much energy is stored in this block. */ public double electricityStored; @@ -343,7 +342,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i @Override public int getMaxSafeInput() { - return 2048; + return Integer.MAX_VALUE; } @Override @@ -401,36 +400,18 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i return (getMaxEnergy() - getEnergy())*Mekanism.TO_IC2; } - @Override - public double getOfferedEnergy() - { - return Math.min(getEnergy()*Mekanism.TO_IC2, getOutput()); - } - @Override public boolean canReceiveEnergy(ForgeDirection side) { return side != getOutputtingSide(); } - @Override - public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) - { - return direction == getOutputtingSide() && !(receiver instanceof TileEntityUniversalCable); - } - @Override public double getOutputEnergyUnitsPerTick() { return getMaxOutput()*Mekanism.TO_IC2; } - @Override - public void drawEnergy(double amount) - { - setEnergy(getEnergy()-amount*Mekanism.FROM_IC2); - } - @Override public double injectEnergyUnits(ForgeDirection direction, double i) { diff --git a/common/mekanism/common/tileentity/TileEntityRotaryCondensentrator.java b/common/mekanism/common/tileentity/TileEntityRotaryCondensentrator.java index a3b70a4c8..670500b7e 100644 --- a/common/mekanism/common/tileentity/TileEntityRotaryCondensentrator.java +++ b/common/mekanism/common/tileentity/TileEntityRotaryCondensentrator.java @@ -1,6 +1,13 @@ package mekanism.common.tileentity; +import mekanism.common.block.BlockMachine.MachineType; +import net.minecraft.item.ItemStack; + public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock { - + public TileEntityRotaryCondensentrator() + { + super("RotaryCondensentrator", MachineType.ROTARY_CONDENSENTRATOR.baseEnergy); + inventory = new ItemStack[5]; + } } diff --git a/common/mekanism/common/tileentity/TileEntityUniversalCable.java b/common/mekanism/common/tileentity/TileEntityUniversalCable.java index 049950e5e..d76e59488 100644 --- a/common/mekanism/common/tileentity/TileEntityUniversalCable.java +++ b/common/mekanism/common/tileentity/TileEntityUniversalCable.java @@ -108,6 +108,9 @@ public class TileEntityUniversalCable extends TileEntityTransmitter