Transformer can now change its multiplier with shift-wrench
This commit is contained in:
parent
adf6fd9127
commit
fc0f5c2011
1 changed files with 26 additions and 18 deletions
|
@ -57,7 +57,7 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
|
||||||
private boolean stepUp;
|
private boolean stepUp;
|
||||||
|
|
||||||
/** Amount to mulitply the step by (up x2. down /2) */
|
/** Amount to mulitply the step by (up x2. down /2) */
|
||||||
public int multiplier = 2;
|
public byte multiplier = 2;
|
||||||
|
|
||||||
public void preparePlacement(int side, int facing)
|
public void preparePlacement(int side, int facing)
|
||||||
{
|
{
|
||||||
|
@ -68,15 +68,17 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
|
||||||
@Override
|
@Override
|
||||||
public void readDesc(MCDataInput packet)
|
public void readDesc(MCDataInput packet)
|
||||||
{
|
{
|
||||||
this.placementSide = ForgeDirection.getOrientation(packet.readByte());
|
placementSide = ForgeDirection.getOrientation(packet.readByte());
|
||||||
this.facing = packet.readByte();
|
facing = packet.readByte();
|
||||||
|
multiplier = packet.readByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeDesc(MCDataOutput packet)
|
public void writeDesc(MCDataOutput packet)
|
||||||
{
|
{
|
||||||
packet.writeByte(this.placementSide.ordinal());
|
packet.writeByte(placementSide.ordinal());
|
||||||
packet.writeByte(this.facing);
|
packet.writeByte(facing);
|
||||||
|
packet.writeByte(multiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean stepUp()
|
public boolean stepUp()
|
||||||
|
@ -240,26 +242,32 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
|
||||||
@Override
|
@Override
|
||||||
public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack item)
|
public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack item)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (this.isUsableWrench(player, player.inventory.getCurrentItem(), x(), y(), z()))
|
if (this.isUsableWrench(player, player.inventory.getCurrentItem(), x(), y(), z()))
|
||||||
{
|
{
|
||||||
if (this.world().isRemote)
|
if (!this.world().isRemote)
|
||||||
{
|
{
|
||||||
return true;
|
if (player.isSneaking())
|
||||||
}
|
{
|
||||||
this.damageWrench(player, player.inventory.getCurrentItem(), x(), y(), z());
|
multiplier = (byte) ((multiplier + 1) % 3);
|
||||||
if (this.facing < 3)
|
sendDescUpdate();
|
||||||
this.facing++;
|
return true;
|
||||||
else
|
}
|
||||||
this.facing = 0;
|
|
||||||
this.sendDescUpdate();
|
|
||||||
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
damageWrench(player, player.inventory.getCurrentItem(), x(), y(), z());
|
||||||
{
|
|
||||||
tile().notifyNeighborChange(dir.ordinal());
|
facing = (byte) ((facing + 1) % 3);
|
||||||
|
|
||||||
|
sendDescUpdate();
|
||||||
|
|
||||||
|
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
tile().notifyNeighborChange(dir.ordinal());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue