Fixed some transformer rotations, incomplete
This commit is contained in:
parent
958cca3180
commit
19ee8e95d0
4 changed files with 20 additions and 60 deletions
|
@ -31,8 +31,7 @@ public class ItemTransformer extends ItemMultipartBase
|
|||
{
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int facing = l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0)));
|
||||
|
||||
part.preparePlacement(facing, itemStack.getItemDamage());
|
||||
part.preparePlacement(side, facing);
|
||||
}
|
||||
|
||||
return part;
|
||||
|
|
|
@ -49,33 +49,33 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
|
|||
}
|
||||
}
|
||||
|
||||
/** Side of the block this is placed on */
|
||||
/** Side of the block this is placed on. */
|
||||
public ForgeDirection placementSide;
|
||||
/** Direction this block faces */
|
||||
public byte face = 0;
|
||||
/** The relative direction this block faces. */
|
||||
public byte facing = 0;
|
||||
/** Step the voltage up */
|
||||
private boolean stepUp;
|
||||
/** Amount to mulitply the step by (up x2. down /2) */
|
||||
public int multiplier = 2;
|
||||
|
||||
public void preparePlacement(int side, int itemDamage)
|
||||
public void preparePlacement(int side, int facing)
|
||||
{
|
||||
placementSide = ForgeDirection.getOrientation((byte) (side ^ 1));
|
||||
face = (byte) side;
|
||||
this.placementSide = ForgeDirection.getOrientation((byte) (side ^ 1));
|
||||
this.facing = (byte) (facing - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readDesc(MCDataInput packet)
|
||||
{
|
||||
this.placementSide = ForgeDirection.getOrientation(packet.readByte());
|
||||
this.face = packet.readByte();
|
||||
this.facing = packet.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDesc(MCDataOutput packet)
|
||||
{
|
||||
packet.writeByte(this.placementSide.ordinal());
|
||||
packet.writeByte(this.face);
|
||||
packet.writeByte(this.facing);
|
||||
}
|
||||
|
||||
public boolean stepUp()
|
||||
|
@ -172,52 +172,13 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
|
|||
|
||||
protected ForgeDirection getFacing()
|
||||
{
|
||||
if (this.placementSide != ForgeDirection.UP && this.placementSide != ForgeDirection.DOWN)
|
||||
{
|
||||
switch (this.face)
|
||||
{
|
||||
case 0:
|
||||
return ForgeDirection.UP;
|
||||
case 1:
|
||||
switch (this.placementSide)
|
||||
{
|
||||
case NORTH:
|
||||
return ForgeDirection.EAST;
|
||||
case SOUTH:
|
||||
return ForgeDirection.WEST;
|
||||
case EAST:
|
||||
return ForgeDirection.SOUTH;
|
||||
case WEST:
|
||||
return ForgeDirection.NORTH;
|
||||
}
|
||||
case 2:
|
||||
return ForgeDirection.DOWN;
|
||||
case 3:
|
||||
switch (this.placementSide)
|
||||
{
|
||||
case NORTH:
|
||||
return ForgeDirection.WEST;
|
||||
case SOUTH:
|
||||
return ForgeDirection.EAST;
|
||||
case EAST:
|
||||
return ForgeDirection.NORTH;
|
||||
case WEST:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ForgeDirection.getOrientation(this.face - 2);
|
||||
}
|
||||
|
||||
return ForgeDirection.NORTH;
|
||||
return ForgeDirection.getOrientation(this.facing + 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction)
|
||||
{
|
||||
return direction == getFacing() || direction == getFacing().getOpposite();
|
||||
return direction.ordinal() == Rotation.rotateSide(placementSide.ordinal(), facing) || direction.ordinal() == Rotation.rotateSide(placementSide.ordinal(), Rotation.rotateSide(facing, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -286,10 +247,10 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
|
|||
return true;
|
||||
}
|
||||
this.damageWrench(player, player.inventory.getCurrentItem(), x(), y(), z());
|
||||
if (this.face < 3)
|
||||
this.face++;
|
||||
if (this.facing < 3)
|
||||
this.facing++;
|
||||
else
|
||||
this.face = 0;
|
||||
this.facing = 0;
|
||||
this.sendDescUpdate();
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
|
|
|
@ -51,6 +51,7 @@ public class RenderTransformer
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
|
||||
RenderUtility.rotateFaceBlockToSide(part.placementSide);
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
RenderUtility.rotateBlockBasedOnDirection(part.getFacing());
|
||||
doRender();
|
||||
GL11.glPopMatrix();
|
||||
|
|
|
@ -282,11 +282,6 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
System.out.println(this.getNetwork());
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (item.getItem().itemID == Block.lever.blockID)
|
||||
|
@ -387,7 +382,11 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
{
|
||||
// We found a wire! Merge networks!
|
||||
this.connections[absDir] = tp;
|
||||
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||
|
||||
if(tp instanceof PartFlatWire)
|
||||
{
|
||||
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue