Finished up large gears!
This commit is contained in:
parent
4fdc27cabe
commit
56ab302f0e
3 changed files with 39 additions and 16 deletions
|
@ -69,15 +69,16 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
getMultiBlock().update();
|
getMultiBlock().update();
|
||||||
super.update();
|
|
||||||
|
if (getMultiBlock().isPrimary())
|
||||||
|
{
|
||||||
|
super.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack item)
|
public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack item)
|
||||||
{
|
{
|
||||||
if (!world().isRemote)
|
|
||||||
System.out.println(getNetwork());
|
|
||||||
|
|
||||||
if (BlockAdvanced.isUsableWrench(player, player.getCurrentEquippedItem(), x(), y(), z()))
|
if (BlockAdvanced.isUsableWrench(player, player.getCurrentEquippedItem(), x(), y(), z()))
|
||||||
{
|
{
|
||||||
if (player.isSneaking())
|
if (player.isSneaking())
|
||||||
|
@ -163,7 +164,6 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
{
|
{
|
||||||
displaceCheck = 2;
|
displaceCheck = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Look for gears outside this block space, the relative UP, DOWN, LEFT, RIGHT */
|
/** Look for gears outside this block space, the relative UP, DOWN, LEFT, RIGHT */
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +221,12 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
@Override
|
@Override
|
||||||
public Object[] getConnections()
|
public Object[] getConnections()
|
||||||
{
|
{
|
||||||
return getMultiBlock().get().connections;
|
if (!getMultiBlock().isPrimary())
|
||||||
|
{
|
||||||
|
return new Object[6];
|
||||||
|
}
|
||||||
|
|
||||||
|
return connections;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -305,10 +310,10 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
@Override
|
@Override
|
||||||
public void onMultiBlockChanged()
|
public void onMultiBlockChanged()
|
||||||
{
|
{
|
||||||
|
tile().notifyPartChange(this);
|
||||||
|
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
refresh();
|
|
||||||
tile().notifyPartChange(this);
|
|
||||||
sendDescUpdate();
|
sendDescUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,6 +353,11 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnect(ForgeDirection from, Object source)
|
public boolean canConnect(ForgeDirection from, Object source)
|
||||||
{
|
{
|
||||||
|
if (!getMultiBlock().isPrimary())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (source instanceof IMechanical)
|
if (source instanceof IMechanical)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -356,6 +366,14 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
*/
|
*/
|
||||||
if (from == placementSide.getOpposite())
|
if (from == placementSide.getOpposite())
|
||||||
{
|
{
|
||||||
|
if (source instanceof PartGear)
|
||||||
|
{
|
||||||
|
if (((PartGear) source).tile() == tile() && !getMultiBlock().isConstructed())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TileEntity sourceTile = getPosition().translate(from.getOpposite()).getTileEntity(world());
|
TileEntity sourceTile = getPosition().translate(from.getOpposite()).getTileEntity(world());
|
||||||
|
|
||||||
if (sourceTile instanceof IMechanical)
|
if (sourceTile instanceof IMechanical)
|
||||||
|
@ -376,7 +394,6 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
{
|
{
|
||||||
if (this != destinationPart)
|
if (this != destinationPart)
|
||||||
{
|
{
|
||||||
System.out.println("WORK" + ((PartGear) destinationPart).isCenterMultiBlock());
|
|
||||||
return ((PartGear) destinationPart).isCenterMultiBlock();
|
return ((PartGear) destinationPart).isCenterMultiBlock();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -384,6 +401,10 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,13 +71,13 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical>
|
||||||
for (int i = 0; i < connections.length; i++)
|
for (int i = 0; i < connections.length; i++)
|
||||||
{
|
{
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||||
Object adacent = connections[i];
|
Object adjacent = connections[i];
|
||||||
|
|
||||||
if (adacent instanceof IMechanical)
|
if (adjacent instanceof IMechanical)
|
||||||
{
|
{
|
||||||
IMechanical adjacentMech = ((IMechanical) adacent).getInstance(dir);
|
IMechanical adjacentMech = ((IMechanical) adjacent).getInstance(dir.getOpposite());
|
||||||
|
|
||||||
if (adjacentMech != null)
|
if (adjacentMech != null && adjacent != mechanical)
|
||||||
{
|
{
|
||||||
float ratio = adjacentMech.getRatio(dir) / mechanical.getRatio(dir.getOpposite());
|
float ratio = adjacentMech.getRatio(dir) / mechanical.getRatio(dir.getOpposite());
|
||||||
long torque = mechanical.getTorque();
|
long torque = mechanical.getTorque();
|
||||||
|
|
|
@ -82,7 +82,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
markPacketUpdate = true;
|
markPacketUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!world().isRemote && markPacketUpdate && ticks % 20 == 0)
|
if (!world().isRemote && markPacketUpdate && ticks % 10 == 0)
|
||||||
{
|
{
|
||||||
sendRotationPacket();
|
sendRotationPacket();
|
||||||
markPacketUpdate = false;
|
markPacketUpdate = false;
|
||||||
|
@ -285,7 +285,8 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
@Override
|
@Override
|
||||||
public void setAngularVelocity(float velocity)
|
public void setAngularVelocity(float velocity)
|
||||||
{
|
{
|
||||||
this.angularVelocity = velocity;
|
if (!world().isRemote)
|
||||||
|
this.angularVelocity = velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -297,7 +298,8 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
@Override
|
@Override
|
||||||
public void setTorque(long torque)
|
public void setTorque(long torque)
|
||||||
{
|
{
|
||||||
this.torque = torque;
|
if (!world().isRemote)
|
||||||
|
this.torque = torque;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue