diff --git a/src/resonantinduction/contractor/TileEntityEMContractor.java b/src/resonantinduction/contractor/TileEntityEMContractor.java index 695e5572..a33a97c3 100644 --- a/src/resonantinduction/contractor/TileEntityEMContractor.java +++ b/src/resonantinduction/contractor/TileEntityEMContractor.java @@ -50,7 +50,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive { pushDelay = Math.max(0, pushDelay - 1); - if (isLatched()) + if (isLatched() && canFunction()) { TileEntity inventoryTile = getLatched(); IInventory inventory = (IInventory) inventoryTile; @@ -219,9 +219,11 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive } } - if (operationBounds != null) + if (operationBounds != null && canFunction()) { List list = worldObj.getEntitiesWithinAABB(Entity.class, operationBounds); + + energyStored -= ENERGY_USAGE; for (Entity entity : list) { @@ -472,7 +474,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive public boolean canFunction() { - return energyStored == ENERGY_USAGE && worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0; + return worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0; } @Override @@ -519,7 +521,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive @Override public float transfer(float transferEnergy, boolean doTransfer) { - float energyToUse = Math.min(transferEnergy, energyStored-ENERGY_USAGE); + float energyToUse = Math.min(transferEnergy, ENERGY_USAGE-energyStored); if(doTransfer) { diff --git a/src/resonantinduction/model/ModelEMContractor.java b/src/resonantinduction/model/ModelEMContractor.java index c5cb65ce..41fe2727 100644 --- a/src/resonantinduction/model/ModelEMContractor.java +++ b/src/resonantinduction/model/ModelEMContractor.java @@ -223,8 +223,13 @@ public class ModelEMContractor extends ModelBase setRotation(nase_depth2, 0F, 0F, 0F); } - public void render(float f5) + public void render(float f5, boolean rotate) { + if(rotate) + { + teslapole.rotateAngleY = (float)Math.toRadians(Math.toDegrees(teslapole.rotateAngleY)+4 < 360 ? Math.toDegrees(teslapole.rotateAngleY)+4 : 0); + } + frame1.render(f5); frame2.render(f5); frame3.render(f5); diff --git a/src/resonantinduction/render/BlockRenderingHandler.java b/src/resonantinduction/render/BlockRenderingHandler.java index b566e7a2..7157f227 100644 --- a/src/resonantinduction/render/BlockRenderingHandler.java +++ b/src/resonantinduction/render/BlockRenderingHandler.java @@ -10,6 +10,7 @@ import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; import resonantinduction.contractor.BlockEMContractor; +import resonantinduction.model.ModelEMContractor; import resonantinduction.tesla.BlockTesla; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; @@ -25,6 +26,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockRenderingHandler implements ISimpleBlockRenderingHandler { public static final BlockRenderingHandler INSTANCE = new BlockRenderingHandler(); + public static final ModelEMContractor MODEL_CONTRACTOR = new ModelEMContractor(); private static final int ID = RenderingRegistry.getNextAvailableRenderId(); @Override @@ -45,7 +47,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler GL11.glTranslated(0.5, 1.5, 0.5); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); FMLClientHandler.instance().getClient().renderEngine.func_110577_a(RenderEMContractor.TEXTURE); - RenderEMContractor.MODEL.render(0.0625f); + MODEL_CONTRACTOR.render(0.0625f, false); GL11.glPopMatrix(); } } diff --git a/src/resonantinduction/render/RenderEMContractor.java b/src/resonantinduction/render/RenderEMContractor.java index eb9d56ac..5b538d23 100644 --- a/src/resonantinduction/render/RenderEMContractor.java +++ b/src/resonantinduction/render/RenderEMContractor.java @@ -12,7 +12,7 @@ import resonantinduction.model.ModelEMContractor; public class RenderEMContractor extends TileEntitySpecialRenderer { - public static final ModelEMContractor MODEL = new ModelEMContractor(); + public ModelEMContractor MODEL = new ModelEMContractor(); public static final ResourceLocation TEXTURE = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "em_contractor.png"); public static final ResourceLocation TEXTURE_PUSH = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "em_contractor_push.png"); @@ -58,8 +58,8 @@ public class RenderEMContractor extends TileEntitySpecialRenderer { this.func_110628_a(TEXTURE_PUSH); } - - MODEL.render(0.0625f); + + MODEL.render(0.0625f, true); GL11.glPopMatrix(); }