Work on rotation
This commit is contained in:
parent
3e194f16e4
commit
e0556e36f9
4 changed files with 18 additions and 9 deletions
|
@ -50,7 +50,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
{
|
{
|
||||||
pushDelay = Math.max(0, pushDelay - 1);
|
pushDelay = Math.max(0, pushDelay - 1);
|
||||||
|
|
||||||
if (isLatched())
|
if (isLatched() && canFunction())
|
||||||
{
|
{
|
||||||
TileEntity inventoryTile = getLatched();
|
TileEntity inventoryTile = getLatched();
|
||||||
IInventory inventory = (IInventory) inventoryTile;
|
IInventory inventory = (IInventory) inventoryTile;
|
||||||
|
@ -219,10 +219,12 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operationBounds != null)
|
if (operationBounds != null && canFunction())
|
||||||
{
|
{
|
||||||
List<Entity> list = worldObj.getEntitiesWithinAABB(Entity.class, operationBounds);
|
List<Entity> list = worldObj.getEntitiesWithinAABB(Entity.class, operationBounds);
|
||||||
|
|
||||||
|
energyStored -= ENERGY_USAGE;
|
||||||
|
|
||||||
for (Entity entity : list)
|
for (Entity entity : list)
|
||||||
{
|
{
|
||||||
if (entity instanceof EntityItem)
|
if (entity instanceof EntityItem)
|
||||||
|
@ -472,7 +474,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
|
|
||||||
public boolean canFunction()
|
public boolean canFunction()
|
||||||
{
|
{
|
||||||
return energyStored == ENERGY_USAGE && worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0;
|
return worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -519,7 +521,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
@Override
|
@Override
|
||||||
public float transfer(float transferEnergy, boolean doTransfer)
|
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)
|
if(doTransfer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -223,8 +223,13 @@ public class ModelEMContractor extends ModelBase
|
||||||
setRotation(nase_depth2, 0F, 0F, 0F);
|
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);
|
frame1.render(f5);
|
||||||
frame2.render(f5);
|
frame2.render(f5);
|
||||||
frame3.render(f5);
|
frame3.render(f5);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import resonantinduction.contractor.BlockEMContractor;
|
import resonantinduction.contractor.BlockEMContractor;
|
||||||
|
import resonantinduction.model.ModelEMContractor;
|
||||||
import resonantinduction.tesla.BlockTesla;
|
import resonantinduction.tesla.BlockTesla;
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
@ -25,6 +26,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||||
{
|
{
|
||||||
public static final BlockRenderingHandler INSTANCE = new BlockRenderingHandler();
|
public static final BlockRenderingHandler INSTANCE = new BlockRenderingHandler();
|
||||||
|
public static final ModelEMContractor MODEL_CONTRACTOR = new ModelEMContractor();
|
||||||
private static final int ID = RenderingRegistry.getNextAvailableRenderId();
|
private static final int ID = RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,7 +47,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||||
GL11.glTranslated(0.5, 1.5, 0.5);
|
GL11.glTranslated(0.5, 1.5, 0.5);
|
||||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(RenderEMContractor.TEXTURE);
|
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(RenderEMContractor.TEXTURE);
|
||||||
RenderEMContractor.MODEL.render(0.0625f);
|
MODEL_CONTRACTOR.render(0.0625f, false);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import resonantinduction.model.ModelEMContractor;
|
||||||
|
|
||||||
public class RenderEMContractor extends TileEntitySpecialRenderer
|
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 = 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");
|
public static final ResourceLocation TEXTURE_PUSH = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "em_contractor_push.png");
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class RenderEMContractor extends TileEntitySpecialRenderer
|
||||||
this.func_110628_a(TEXTURE_PUSH);
|
this.func_110628_a(TEXTURE_PUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
MODEL.render(0.0625f);
|
MODEL.render(0.0625f, true);
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue