Trying to fix the sync issue
This commit is contained in:
parent
4fcdf22220
commit
8055546675
7 changed files with 125 additions and 5 deletions
|
@ -82,5 +82,4 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable {
|
|||
inventory.writeToNBT(tagCompound);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -91,6 +91,20 @@ public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IE
|
|||
crafter.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readSyncFromNBT(tagCompound);
|
||||
energy.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeSyncToNBT(tagCompound);
|
||||
energy.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate(){
|
||||
energy.invalidate();
|
||||
|
|
|
@ -8,6 +8,8 @@ import net.minecraft.network.Packet;
|
|||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import techreborn.packets.PacketHandler;
|
||||
import techreborn.packets.PacketSync;
|
||||
import techreborn.packets.SimplePacket;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -33,6 +35,7 @@ public class TileMachineBase extends TileEntity {
|
|||
|
||||
public void syncWithAll() {
|
||||
if (!worldObj.isRemote) {
|
||||
//PacketHandler.sendPacketToAllPlayers(getSyncPacket());
|
||||
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),
|
||||
worldObj);
|
||||
} else {
|
||||
|
@ -42,6 +45,19 @@ public class TileMachineBase extends TileEntity {
|
|||
ticksSinceLastSync = 0;
|
||||
}
|
||||
|
||||
public Packet getDescriptionPacket2() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeSyncToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord,
|
||||
this.zCoord, 1, nbtTag);
|
||||
}
|
||||
|
||||
public SimplePacket getSyncPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeSyncToNBT(nbtTag);
|
||||
return new PacketSync(nbtTag, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
|
@ -56,5 +72,13 @@ public class TileMachineBase extends TileEntity {
|
|||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
public void readSyncFromNBT(NBTTagCompound tagCompound) {
|
||||
|
||||
}
|
||||
|
||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue