mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-15 02:20:05 +00:00
save -> saveAdditional
Also add in a janky workabround for handleUpdateTag not being called. Being an early porter is always fun :D:.
This commit is contained in:
parent
87988a705b
commit
23c17075be
@ -188,16 +188,15 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
|
||||
protected abstract void updateBlockState( ComputerState newState );
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
// Save ID, label and power state
|
||||
if( computerID >= 0 ) nbt.putInt( NBT_ID, computerID );
|
||||
if( label != null ) nbt.putString( NBT_LABEL, label );
|
||||
nbt.putBoolean( NBT_ON, on );
|
||||
|
||||
return super.save( nbt );
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,9 +137,8 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
if( customName != null ) nbt.putString( NBT_NAME, Component.Serializer.toJson( customName ) );
|
||||
|
||||
@ -149,7 +148,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
diskStack.save( item );
|
||||
nbt.put( NBT_ITEM, item );
|
||||
}
|
||||
return super.save( nbt );
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
void serverTick()
|
||||
|
@ -292,13 +292,12 @@ public class TileCable extends TileGeneric
|
||||
peripheral.read( nbt, "" );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( CompoundTag nbt )
|
||||
public void saveAdditional( CompoundTag nbt )
|
||||
{
|
||||
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
|
||||
peripheral.write( nbt, "" );
|
||||
return super.save( nbt );
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
private void updateBlockState()
|
||||
|
@ -241,13 +241,12 @@ public class TileWiredModemFull extends TileGeneric
|
||||
for( int i = 0; i < peripherals.length; i++ ) peripherals[i].read( nbt, Integer.toString( i ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( CompoundTag nbt )
|
||||
public void saveAdditional( CompoundTag nbt )
|
||||
{
|
||||
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
|
||||
for( int i = 0; i < peripherals.length; i++ ) peripherals[i].write( nbt, Integer.toString( i ) );
|
||||
return super.save( nbt );
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
private void updateBlockState()
|
||||
|
@ -127,20 +127,26 @@ public class TileMonitor extends TileGeneric
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( CompoundTag tag )
|
||||
public void saveAdditional( CompoundTag tag )
|
||||
{
|
||||
tag.putInt( NBT_X, xIndex );
|
||||
tag.putInt( NBT_Y, yIndex );
|
||||
tag.putInt( NBT_WIDTH, width );
|
||||
tag.putInt( NBT_HEIGHT, height );
|
||||
return super.save( tag );
|
||||
super.saveAdditional( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
if( level != null && level.isClientSide )
|
||||
{
|
||||
// TODO: Remove once https://github.com/MinecraftForge/MinecraftForge/pull/8237 is merged.
|
||||
handleUpdateTag( nbt );
|
||||
return;
|
||||
}
|
||||
|
||||
super.load( nbt );
|
||||
|
||||
xIndex = nbt.getInt( NBT_X );
|
||||
|
@ -113,9 +113,8 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
ContainerHelper.loadAllItems( nbt, inventory );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
if( customName != null ) nbt.putString( NBT_NAME, Component.Serializer.toJson( customName ) );
|
||||
|
||||
@ -130,7 +129,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
// Write inventory
|
||||
ContainerHelper.saveAllItems( nbt, inventory );
|
||||
|
||||
return super.save( nbt );
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
boolean isPrinting()
|
||||
|
@ -289,9 +289,8 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
||||
brain.readFromNBT( nbt );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
// Write inventory
|
||||
ListTag nbttaglist = new ListTag();
|
||||
@ -310,7 +309,7 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
||||
// Write brain
|
||||
nbt = brain.writeToNBT( nbt );
|
||||
|
||||
return super.save( nbt );
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user