mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-30 21:23:00 +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:
		| @@ -205,6 +205,13 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT | |||||||
|         on = startOn = nbt.getBoolean( NBT_ON ); |         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 ) |     protected boolean isPeripheralBlockedOnSide( ComputerSide localSide ) | ||||||
|     { |     { | ||||||
|         return false; |         return false; | ||||||
| @@ -396,13 +403,6 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT | |||||||
|         return nbt; |         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 ) |     protected void transferStateFrom( TileComputerBase copy ) | ||||||
|     { |     { | ||||||
|         if( copy.computerID != computerID || copy.instanceID != instanceID ) |         if( copy.computerID != computerID || copy.instanceID != instanceID ) | ||||||
|   | |||||||
| @@ -137,12 +137,57 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile | |||||||
|     { |     { | ||||||
|         super.load( nbt ); |         super.load( nbt ); | ||||||
|  |  | ||||||
|  |         int oldXIndex = xIndex; | ||||||
|  |         int oldYIndex = yIndex; | ||||||
|  |  | ||||||
|         xIndex = nbt.getInt( NBT_X ); |         xIndex = nbt.getInt( NBT_X ); | ||||||
|         yIndex = nbt.getInt( NBT_Y ); |         yIndex = nbt.getInt( NBT_Y ); | ||||||
|         width = nbt.getInt( NBT_WIDTH ); |         width = nbt.getInt( NBT_WIDTH ); | ||||||
|         height = nbt.getInt( NBT_HEIGHT ); |         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 |     @Override | ||||||
|     public void blockTick() |     public void blockTick() | ||||||
|     { |     { | ||||||
| @@ -258,34 +303,6 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile | |||||||
|         return nbt; |         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 ) |     public final void read( TerminalState state ) | ||||||
|     { |     { | ||||||
|         if( xIndex != 0 || yIndex != 0 ) |         if( xIndex != 0 || yIndex != 0 ) | ||||||
|   | |||||||
| @@ -267,8 +267,16 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default | |||||||
|  |  | ||||||
|         // Read state |         // Read state | ||||||
|         brain.readFromNBT( nbt ); |         brain.readFromNBT( nbt ); | ||||||
|  |         brain.readDescription( nbt ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     //    @Override | ||||||
|  |     //    public void handleUpdateTag( @Nonnull CompoundTag nbt ) | ||||||
|  |     //    { | ||||||
|  |     //        super.handleUpdateTag( nbt ); | ||||||
|  |     //        brain.readDescription( nbt ); | ||||||
|  |     //    } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void saveAdditional( @Nonnull CompoundTag nbt ) |     public void saveAdditional( @Nonnull CompoundTag nbt ) | ||||||
|     { |     { | ||||||
| @@ -492,13 +500,6 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default | |||||||
|         return nbt; |         return nbt; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     //    @Override |  | ||||||
|     //    public void handleUpdateTag( @Nonnull CompoundTag nbt ) |  | ||||||
|     //    { |  | ||||||
|     //        super.handleUpdateTag( nbt ); |  | ||||||
|     //        brain.readDescription( nbt ); |  | ||||||
|     //    } |  | ||||||
|  |  | ||||||
|     // Privates |     // Privates | ||||||
|  |  | ||||||
|     private boolean hasPeripheralUpgradeOnSide( ComputerSide side ) |     private boolean hasPeripheralUpgradeOnSide( ComputerSide side ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Toad-Dev
					Toad-Dev