mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Fixed a syncing bug with tileentities on world join
This commit is contained in:
parent
6c94c08ba4
commit
7e682af51d
3 changed files with 14 additions and 14 deletions
|
@ -129,7 +129,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
||||||
this.readSyncableNBT(compound, true);
|
this.readSyncableNBT(compound, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getUpdateTag(){
|
public NBTTagCompound getUpdateTag(){
|
||||||
NBTTagCompound tag = super.getUpdateTag();
|
NBTTagCompound tag = super.getUpdateTag();
|
||||||
|
@ -137,6 +136,11 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleUpdateTag(NBTTagCompound compound){
|
||||||
|
this.receiveSyncCompound(compound);
|
||||||
|
}
|
||||||
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
if(!isForSync){
|
if(!isForSync){
|
||||||
compound.setBoolean("Redstone", this.isRedstonePowered);
|
compound.setBoolean("Redstone", this.isRedstonePowered);
|
||||||
|
|
|
@ -38,19 +38,15 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveSyncCompound(NBTTagCompound compound){
|
public void receiveSyncCompound(NBTTagCompound compound){
|
||||||
BlockPos thisPos = this.pos;
|
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(this.pos);
|
||||||
if(compound != null){
|
|
||||||
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
|
|
||||||
|
|
||||||
NBTTagList list = compound.getTagList("Connections", 10);
|
NBTTagList list = compound.getTagList("Connections", 10);
|
||||||
|
if(!list.hasNoTags()){
|
||||||
for(int i = 0; i < list.tagCount(); i++){
|
for(int i = 0; i < list.tagCount(); i++){
|
||||||
LaserRelayConnectionHandler.ConnectionPair pair = LaserRelayConnectionHandler.ConnectionPair.readFromNBT(list.getCompoundTagAt(i));
|
LaserRelayConnectionHandler.ConnectionPair pair = LaserRelayConnectionHandler.ConnectionPair.readFromNBT(list.getCompoundTagAt(i));
|
||||||
LaserRelayConnectionHandler.getInstance().addConnection(pair.firstRelay, pair.secondRelay);
|
LaserRelayConnectionHandler.getInstance().addConnection(pair.firstRelay, pair.secondRelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.receiveSyncCompound(compound);
|
super.receiveSyncCompound(compound);
|
||||||
}
|
}
|
||||||
|
@ -59,17 +55,16 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getUpdateTag(){
|
public NBTTagCompound getUpdateTag(){
|
||||||
NBTTagCompound compound = super.getUpdateTag();
|
NBTTagCompound compound = super.getUpdateTag();
|
||||||
|
|
||||||
BlockPos thisPos = this.pos;
|
|
||||||
ConcurrentSet<LaserRelayConnectionHandler.ConnectionPair> connections = LaserRelayConnectionHandler.getInstance().getConnectionsFor(thisPos);
|
|
||||||
|
|
||||||
if(connections != null){
|
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
|
|
||||||
|
ConcurrentSet<LaserRelayConnectionHandler.ConnectionPair> connections = LaserRelayConnectionHandler.getInstance().getConnectionsFor(this.pos);
|
||||||
|
if(connections != null && !connections.isEmpty()){
|
||||||
for(LaserRelayConnectionHandler.ConnectionPair pair : connections){
|
for(LaserRelayConnectionHandler.ConnectionPair pair : connections){
|
||||||
list.appendTag(pair.writeToNBT());
|
list.appendTag(pair.writeToNBT());
|
||||||
}
|
}
|
||||||
compound.setTag("Connections", list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compound.setTag("Connections", list);
|
||||||
return compound;
|
return compound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Made shovels make path blocks instead of farmland
|
* Made shovels make path blocks instead of farmland
|
||||||
* Changed world data save system to hopefully make laser relays not disconnect on certain occasions but only on the server and I don't get why this is happening
|
* Changed world data save system to hopefully make laser relays not disconnect on certain occasions but only on the server and I don't get why this is happening
|
||||||
* Made tools be held like tools and not like normal items in third person
|
* Made tools be held like tools and not like normal items in third person
|
||||||
|
* Fixed a syncing bug with tileentities on world join
|
||||||
|
|
||||||
# 1.9.4-r36
|
# 1.9.4-r36
|
||||||
* Added a config option to print all of the booklet's text into a file on startup
|
* Added a config option to print all of the booklet's text into a file on startup
|
||||||
|
|
Loading…
Reference in a new issue