Polished off Contractor, just need to finish energy usage.
This commit is contained in:
parent
ca0fca1fa1
commit
6b94b4d05a
3 changed files with 28 additions and 15 deletions
|
@ -27,8 +27,8 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
{
|
{
|
||||||
public static int MAX_REACH = 40;
|
public static int MAX_REACH = 40;
|
||||||
public static int PUSH_DELAY = 5;
|
public static int PUSH_DELAY = 5;
|
||||||
public static double MAX_SPEED = .1;
|
public static double MAX_SPEED = .2;
|
||||||
public static double ACCELERATION = .01;
|
public static double ACCELERATION = .02;
|
||||||
public static float ENERGY_USAGE = .005F;
|
public static float ENERGY_USAGE = .005F;
|
||||||
|
|
||||||
private ForgeDirection facing = ForgeDirection.UP;
|
private ForgeDirection facing = ForgeDirection.UP;
|
||||||
|
@ -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() && canFunction())
|
if (canFunction())
|
||||||
{
|
{
|
||||||
TileEntity inventoryTile = getLatched();
|
TileEntity inventoryTile = getLatched();
|
||||||
IInventory inventory = (IInventory) inventoryTile;
|
IInventory inventory = (IInventory) inventoryTile;
|
||||||
|
@ -248,7 +248,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entityItem.motionY = Math.min((MAX_SPEED * 4), entityItem.motionY + (ACCELERATION * 5));
|
entityItem.motionY = Math.min(MAX_SPEED, entityItem.motionY + .04 + ACCELERATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
entityItem.isAirBorne = true;
|
entityItem.isAirBorne = true;
|
||||||
|
@ -264,7 +264,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
|
|
||||||
if (!suck)
|
if (!suck)
|
||||||
{
|
{
|
||||||
entityItem.motionY = Math.min((MAX_SPEED * 4), entityItem.motionY + (ACCELERATION * 5));
|
entityItem.motionY = Math.min(MAX_SPEED, entityItem.motionY + .04 + ACCELERATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -366,25 +366,27 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
switch (facing)
|
switch (facing)
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
item = new EntityItem(worldObj, xCoord + 0.5, yCoord, zCoord + 0.5, toSend);
|
item = new EntityItem(worldObj, xCoord + 0.5, yCoord - 0.2, zCoord + 0.5, toSend);
|
||||||
break;
|
break;
|
||||||
case UP:
|
case UP:
|
||||||
item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, toSend);
|
item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.2, zCoord + 0.5, toSend);
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord, toSend);
|
item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord - 0.2, toSend);
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 1, toSend);
|
item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 1.2, toSend);
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
item = new EntityItem(worldObj, xCoord, yCoord + 0.5, zCoord + 0.5, toSend);
|
item = new EntityItem(worldObj, xCoord - 0.2, yCoord + 0.5, zCoord + 0.5, toSend);
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
item = new EntityItem(worldObj, xCoord + 1, yCoord + 0.5, zCoord + 0.5, toSend);
|
item = new EntityItem(worldObj, xCoord + 1.2, yCoord + 0.5, zCoord + 0.5, toSend);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item.setVelocity(0, 0, 0);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +476,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
|
|
||||||
public boolean canFunction()
|
public boolean canFunction()
|
||||||
{
|
{
|
||||||
return worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0;
|
return isLatched() && worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -484,6 +486,9 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
|
|
||||||
facing = ForgeDirection.getOrientation(nbtTags.getInteger("facing"));
|
facing = ForgeDirection.getOrientation(nbtTags.getInteger("facing"));
|
||||||
suck = nbtTags.getBoolean("suck");
|
suck = nbtTags.getBoolean("suck");
|
||||||
|
energyStored = nbtTags.getFloat("energyStored");
|
||||||
|
|
||||||
|
updateBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -493,6 +498,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
|
|
||||||
nbtTags.setInteger("facing", facing.ordinal());
|
nbtTags.setInteger("facing", facing.ordinal());
|
||||||
nbtTags.setBoolean("suck", suck);
|
nbtTags.setBoolean("suck", suck);
|
||||||
|
nbtTags.setFloat("energyStored", energyStored);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -502,6 +508,8 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
{
|
{
|
||||||
facing = ForgeDirection.getOrientation(input.readInt());
|
facing = ForgeDirection.getOrientation(input.readInt());
|
||||||
suck = input.readBoolean();
|
suck = input.readBoolean();
|
||||||
|
energyStored = input.readFloat();
|
||||||
|
|
||||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||||
updateBounds();
|
updateBounds();
|
||||||
}
|
}
|
||||||
|
@ -515,6 +523,8 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
||||||
{
|
{
|
||||||
data.add(facing.ordinal());
|
data.add(facing.ordinal());
|
||||||
data.add(suck);
|
data.add(suck);
|
||||||
|
data.add(energyStored);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,10 @@ public class ModelEMContractor extends ModelBase
|
||||||
{
|
{
|
||||||
if(rotate)
|
if(rotate)
|
||||||
{
|
{
|
||||||
teslapole.rotateAngleY = (float)Math.toRadians(Math.toDegrees(teslapole.rotateAngleY)+4 < 360 ? Math.toDegrees(teslapole.rotateAngleY)+4 : 0);
|
Coil1.rotateAngleY = (float)Math.toRadians(Math.toDegrees(Coil1.rotateAngleY)+3 < 360 ? Math.toDegrees(Coil1.rotateAngleY)+3 : 0);
|
||||||
|
coil2.rotateAngleY = (float)Math.toRadians(Math.toDegrees(coil2.rotateAngleY)+3 < 360 ? Math.toDegrees(coil2.rotateAngleY)+3 : 0);
|
||||||
|
coil3.rotateAngleY = (float)Math.toRadians(Math.toDegrees(coil3.rotateAngleY)+3 < 360 ? Math.toDegrees(coil3.rotateAngleY)+3 : 0);
|
||||||
|
coil4.rotateAngleY = (float)Math.toRadians(Math.toDegrees(coil4.rotateAngleY)+3 < 360 ? Math.toDegrees(coil4.rotateAngleY)+3 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame1.render(f5);
|
frame1.render(f5);
|
||||||
|
|
|
@ -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, true);
|
MODEL.render(0.0625f, ((TileEntityEMContractor)t).canFunction());
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue