mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-28 16:22:18 +00:00
Fix BlockEntity syncing.
Fabric does not have a separate handler for update packets vs load. Perhaps we should check if the CompoundTag contains an animation value in TurtleBrain#readDescription but nbt.getInt defaults to 0 and that's TurtleAnimation.NONE so...
This commit is contained in:
parent
6c519aef63
commit
745b732e87
@ -205,6 +205,13 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
on = startOn = nbt.getBoolean( NBT_ON );
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void handleUpdateTag( @Nonnull CompoundTag nbt )
|
||||
// {
|
||||
// label = nbt.contains( NBT_LABEL ) ? nbt.getString( NBT_LABEL ) : null;
|
||||
// computerID = nbt.contains( NBT_ID ) ? nbt.getInt( NBT_ID ) : -1;
|
||||
// }
|
||||
|
||||
protected boolean isPeripheralBlockedOnSide( ComputerSide localSide )
|
||||
{
|
||||
return false;
|
||||
@ -396,13 +403,6 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
return nbt;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void handleUpdateTag( @Nonnull CompoundTag nbt )
|
||||
// {
|
||||
// label = nbt.contains( NBT_LABEL ) ? nbt.getString( NBT_LABEL ) : null;
|
||||
// computerID = nbt.contains( NBT_ID ) ? nbt.getInt( NBT_ID ) : -1;
|
||||
// }
|
||||
|
||||
protected void transferStateFrom( TileComputerBase copy )
|
||||
{
|
||||
if( copy.computerID != computerID || copy.instanceID != instanceID )
|
||||
|
@ -137,12 +137,57 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile
|
||||
{
|
||||
super.load( nbt );
|
||||
|
||||
int oldXIndex = xIndex;
|
||||
int oldYIndex = yIndex;
|
||||
|
||||
xIndex = nbt.getInt( NBT_X );
|
||||
yIndex = nbt.getInt( NBT_Y );
|
||||
width = nbt.getInt( NBT_WIDTH );
|
||||
height = nbt.getInt( NBT_HEIGHT );
|
||||
|
||||
if( oldXIndex != xIndex || oldYIndex != yIndex )
|
||||
{
|
||||
// If our index has changed then it's possible the origin monitor has changed. Thus
|
||||
// we'll clear our cache. If we're the origin then we'll need to remove the glList as well.
|
||||
if( oldXIndex == 0 && oldYIndex == 0 && clientMonitor != null ) clientMonitor.destroy();
|
||||
clientMonitor = null;
|
||||
}
|
||||
|
||||
if( xIndex == 0 && yIndex == 0 )
|
||||
{
|
||||
// If we're the origin terminal then create it.
|
||||
if( clientMonitor == null ) clientMonitor = new ClientMonitor( advanced, this );
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public final void handleUpdateTag( @Nonnull CompoundTag nbt )
|
||||
// {
|
||||
// super.handleUpdateTag( nbt );
|
||||
//
|
||||
// int oldXIndex = xIndex;
|
||||
// int oldYIndex = yIndex;
|
||||
//
|
||||
// xIndex = nbt.getInt( NBT_X );
|
||||
// yIndex = nbt.getInt( NBT_Y );
|
||||
// width = nbt.getInt( NBT_WIDTH );
|
||||
// height = nbt.getInt( NBT_HEIGHT );
|
||||
//
|
||||
// if( oldXIndex != xIndex || oldYIndex != yIndex )
|
||||
// {
|
||||
// // If our index has changed then it's possible the origin monitor has changed. Thus
|
||||
// // we'll clear our cache. If we're the origin then we'll need to remove the glList as well.
|
||||
// if( oldXIndex == 0 && oldYIndex == 0 && clientMonitor != null ) clientMonitor.destroy();
|
||||
// clientMonitor = null;
|
||||
// }
|
||||
//
|
||||
// if( xIndex == 0 && yIndex == 0 )
|
||||
// {
|
||||
// // If we're the origin terminal then create it.
|
||||
// if( clientMonitor == null ) clientMonitor = new ClientMonitor( advanced, this );
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void blockTick()
|
||||
{
|
||||
@ -258,34 +303,6 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile
|
||||
return nbt;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public final void handleUpdateTag( @Nonnull CompoundTag nbt )
|
||||
// {
|
||||
// super.handleUpdateTag( nbt );
|
||||
//
|
||||
// int oldXIndex = xIndex;
|
||||
// int oldYIndex = yIndex;
|
||||
//
|
||||
// xIndex = nbt.getInt( NBT_X );
|
||||
// yIndex = nbt.getInt( NBT_Y );
|
||||
// width = nbt.getInt( NBT_WIDTH );
|
||||
// height = nbt.getInt( NBT_HEIGHT );
|
||||
//
|
||||
// if( oldXIndex != xIndex || oldYIndex != yIndex )
|
||||
// {
|
||||
// // If our index has changed then it's possible the origin monitor has changed. Thus
|
||||
// // we'll clear our cache. If we're the origin then we'll need to remove the glList as well.
|
||||
// if( oldXIndex == 0 && oldYIndex == 0 && clientMonitor != null ) clientMonitor.destroy();
|
||||
// clientMonitor = null;
|
||||
// }
|
||||
//
|
||||
// if( xIndex == 0 && yIndex == 0 )
|
||||
// {
|
||||
// // If we're the origin terminal then create it.
|
||||
// if( clientMonitor == null ) clientMonitor = new ClientMonitor( advanced, this );
|
||||
// }
|
||||
// }
|
||||
|
||||
public final void read( TerminalState state )
|
||||
{
|
||||
if( xIndex != 0 || yIndex != 0 )
|
||||
|
@ -267,8 +267,16 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
||||
|
||||
// Read state
|
||||
brain.readFromNBT( nbt );
|
||||
brain.readDescription( nbt );
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void handleUpdateTag( @Nonnull CompoundTag nbt )
|
||||
// {
|
||||
// super.handleUpdateTag( nbt );
|
||||
// brain.readDescription( nbt );
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
@ -492,13 +500,6 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
||||
return nbt;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void handleUpdateTag( @Nonnull CompoundTag nbt )
|
||||
// {
|
||||
// super.handleUpdateTag( nbt );
|
||||
// brain.readDescription( nbt );
|
||||
// }
|
||||
|
||||
// Privates
|
||||
|
||||
private boolean hasPeripheralUpgradeOnSide( ComputerSide side )
|
||||
|
Loading…
x
Reference in New Issue
Block a user