Fixed #250 - Conveyor belts not sending packets
This commit is contained in:
parent
cbaf9884e6
commit
8352961a94
3 changed files with 22 additions and 27 deletions
|
@ -30,7 +30,7 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
*
|
*
|
||||||
* @author DarkGuardsman
|
* @author DarkGuardsman
|
||||||
*/
|
*/
|
||||||
public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatable, IPacketReceiverWithID
|
public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatable
|
||||||
{
|
{
|
||||||
public enum SlantType
|
public enum SlantType
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,6 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
|
||||||
markRefresh = false;
|
markRefresh = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,29 +126,15 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
public void onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||||
{
|
{
|
||||||
if (this.worldObj.isRemote)
|
super.onReceivePacket(id, data, player, extra);
|
||||||
{
|
|
||||||
try
|
if (id == PACKET_SLANT)
|
||||||
{
|
this.slantType = SlantType.values()[data.readInt()];
|
||||||
if (id == PACKET_SLANT)
|
else if (id == PACKET_REFRESH)
|
||||||
{
|
refresh();
|
||||||
this.slantType = SlantType.values()[data.readInt()];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (id == PACKET_REFRESH)
|
|
||||||
{
|
|
||||||
refresh();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlantType getSlant()
|
public SlantType getSlant()
|
||||||
|
|
|
@ -189,7 +189,8 @@ public class PartPipe extends PartFramedConnection<EnumPipeMaterial, IFluidPipe,
|
||||||
protected IFluidPipe getConnector(TileEntity tile)
|
protected IFluidPipe getConnector(TileEntity tile)
|
||||||
{
|
{
|
||||||
if (tile instanceof IFluidPipe)
|
if (tile instanceof IFluidPipe)
|
||||||
return (IFluidPipe) ((IFluidPipe) tile).getInstance(ForgeDirection.UNKNOWN);
|
if (((IFluidPipe) tile).getInstance(ForgeDirection.UNKNOWN) instanceof IFluidPipe)
|
||||||
|
return (IFluidPipe) ((IFluidPipe) tile).getInstance(ForgeDirection.UNKNOWN);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.api.mechanical.IMechanical;
|
import resonantinduction.api.mechanical.IMechanical;
|
||||||
import resonantinduction.api.mechanical.IMechanicalNetwork;
|
import resonantinduction.api.mechanical.IMechanicalNetwork;
|
||||||
import resonantinduction.core.ResonantInduction;
|
import resonantinduction.core.ResonantInduction;
|
||||||
|
import resonantinduction.mechanical.Mechanical;
|
||||||
import resonantinduction.mechanical.gear.PartGearShaft;
|
import resonantinduction.mechanical.gear.PartGearShaft;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
import calclavia.lib.network.IPacketReceiver;
|
import calclavia.lib.network.IPacketReceiver;
|
||||||
|
@ -17,6 +18,8 @@ import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
public abstract class TileMechanical extends TileAdvanced implements IMechanical, IPacketReceiver
|
public abstract class TileMechanical extends TileAdvanced implements IMechanical, IPacketReceiver
|
||||||
{
|
{
|
||||||
|
protected static final int PACKET_VELOCITY = Mechanical.contentRegistry.getNextPacketID();
|
||||||
|
|
||||||
/** The mechanical connections this connector has made */
|
/** The mechanical connections this connector has made */
|
||||||
protected Object[] connections = new Object[6];
|
protected Object[] connections = new Object[6];
|
||||||
private IMechanicalNetwork network;
|
private IMechanicalNetwork network;
|
||||||
|
@ -59,13 +62,19 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical
|
||||||
|
|
||||||
private void sendRotationPacket()
|
private void sendRotationPacket()
|
||||||
{
|
{
|
||||||
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, angularVelocity), worldObj, new Vector3(this), 20);
|
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, PACKET_VELOCITY, angularVelocity), worldObj, new Vector3(this), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||||
{
|
{
|
||||||
angularVelocity = data.readFloat();
|
onReceivePacket(data.readInt(), data, player, extra);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||||
|
{
|
||||||
|
if (id == PACKET_VELOCITY)
|
||||||
|
angularVelocity = data.readFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue