mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-28 05:33:22 +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 );
|
protected abstract void updateBlockState( ComputerState newState );
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||||
{
|
{
|
||||||
// Save ID, label and power state
|
// Save ID, label and power state
|
||||||
if( computerID >= 0 ) nbt.putInt( NBT_ID, computerID );
|
if( computerID >= 0 ) nbt.putInt( NBT_ID, computerID );
|
||||||
if( label != null ) nbt.putString( NBT_LABEL, label );
|
if( label != null ) nbt.putString( NBT_LABEL, label );
|
||||||
nbt.putBoolean( NBT_ON, on );
|
nbt.putBoolean( NBT_ON, on );
|
||||||
|
|
||||||
return super.save( nbt );
|
super.saveAdditional( nbt );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,9 +137,8 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||||
{
|
{
|
||||||
if( customName != null ) nbt.putString( NBT_NAME, Component.Serializer.toJson( customName ) );
|
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 );
|
diskStack.save( item );
|
||||||
nbt.put( NBT_ITEM, item );
|
nbt.put( NBT_ITEM, item );
|
||||||
}
|
}
|
||||||
return super.save( nbt );
|
super.saveAdditional( nbt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void serverTick()
|
void serverTick()
|
||||||
|
@ -292,13 +292,12 @@ public class TileCable extends TileGeneric
|
|||||||
peripheral.read( nbt, "" );
|
peripheral.read( nbt, "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag save( CompoundTag nbt )
|
public void saveAdditional( CompoundTag nbt )
|
||||||
{
|
{
|
||||||
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
|
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
|
||||||
peripheral.write( nbt, "" );
|
peripheral.write( nbt, "" );
|
||||||
return super.save( nbt );
|
super.saveAdditional( nbt );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBlockState()
|
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 ) );
|
for( int i = 0; i < peripherals.length; i++ ) peripherals[i].read( nbt, Integer.toString( i ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag save( CompoundTag nbt )
|
public void saveAdditional( CompoundTag nbt )
|
||||||
{
|
{
|
||||||
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
|
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
|
||||||
for( int i = 0; i < peripherals.length; i++ ) peripherals[i].write( nbt, Integer.toString( i ) );
|
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()
|
private void updateBlockState()
|
||||||
|
@ -127,20 +127,26 @@ public class TileMonitor extends TileGeneric
|
|||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag save( CompoundTag tag )
|
public void saveAdditional( CompoundTag tag )
|
||||||
{
|
{
|
||||||
tag.putInt( NBT_X, xIndex );
|
tag.putInt( NBT_X, xIndex );
|
||||||
tag.putInt( NBT_Y, yIndex );
|
tag.putInt( NBT_Y, yIndex );
|
||||||
tag.putInt( NBT_WIDTH, width );
|
tag.putInt( NBT_WIDTH, width );
|
||||||
tag.putInt( NBT_HEIGHT, height );
|
tag.putInt( NBT_HEIGHT, height );
|
||||||
return super.save( tag );
|
super.saveAdditional( tag );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load( @Nonnull CompoundTag nbt )
|
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 );
|
super.load( nbt );
|
||||||
|
|
||||||
xIndex = nbt.getInt( NBT_X );
|
xIndex = nbt.getInt( NBT_X );
|
||||||
|
@ -113,9 +113,8 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
|||||||
ContainerHelper.loadAllItems( nbt, inventory );
|
ContainerHelper.loadAllItems( nbt, inventory );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||||
{
|
{
|
||||||
if( customName != null ) nbt.putString( NBT_NAME, Component.Serializer.toJson( customName ) );
|
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
|
// Write inventory
|
||||||
ContainerHelper.saveAllItems( nbt, inventory );
|
ContainerHelper.saveAllItems( nbt, inventory );
|
||||||
|
|
||||||
return super.save( nbt );
|
super.saveAdditional( nbt );
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isPrinting()
|
boolean isPrinting()
|
||||||
|
@ -289,9 +289,8 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
|||||||
brain.readFromNBT( nbt );
|
brain.readFromNBT( nbt );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||||
{
|
{
|
||||||
// Write inventory
|
// Write inventory
|
||||||
ListTag nbttaglist = new ListTag();
|
ListTag nbttaglist = new ListTag();
|
||||||
@ -310,7 +309,7 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
|||||||
// Write brain
|
// Write brain
|
||||||
nbt = brain.writeToNBT( nbt );
|
nbt = brain.writeToNBT( nbt );
|
||||||
|
|
||||||
return super.save( nbt );
|
super.saveAdditional( nbt );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user