1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-12 19:33:00 +00:00

A couple of minor reformats

- nbttagcompount -> nbt. It's shorter, and hopefully will avoid
   ambiguities with 'tag' in 1.13+.
 - Remove several redundant != null checks.
This commit is contained in:
SquidDev
2018-12-29 14:01:00 +00:00
parent 54acf1d087
commit ca334e7e5c
27 changed files with 282 additions and 323 deletions

View File

@@ -52,12 +52,12 @@ public class ClientTerminal implements ITerminal
return m_colour;
}
public void readDescription( NBTTagCompound nbttagcompound )
public void readDescription( NBTTagCompound nbt )
{
m_colour = nbttagcompound.getBoolean( "colour" );
if( nbttagcompound.hasKey( "terminal" ) )
m_colour = nbt.getBoolean( "colour" );
if( nbt.hasKey( "terminal" ) )
{
NBTTagCompound terminal = nbttagcompound.getCompoundTag( "terminal" );
NBTTagCompound terminal = nbt.getCompoundTag( "terminal" );
resizeTerminal( terminal.getInteger( "term_width" ), terminal.getInteger( "term_height" ) );
m_terminal.readFromNBT( terminal );
}

View File

@@ -29,7 +29,7 @@ public class DefaultBundledRedstoneProvider implements IBundledRedstoneProvider
public static int getDefaultBundledRedstoneOutput( World world, BlockPos pos, EnumFacing side )
{
Block block = world.getBlockState( pos ).getBlock();
if( block != null && block instanceof BlockGeneric )
if( block instanceof BlockGeneric )
{
BlockGeneric generic = (BlockGeneric) block;
if( generic.getBundledRedstoneConnectivity( world, pos, side ) )

View File

@@ -90,16 +90,16 @@ public class ServerTerminal implements ITerminal
// Networking stuff
public void writeDescription( NBTTagCompound nbttagcompound )
public void writeDescription( NBTTagCompound nbt )
{
nbttagcompound.setBoolean( "colour", m_colour );
nbt.setBoolean( "colour", m_colour );
if( m_terminal != null )
{
NBTTagCompound terminal = new NBTTagCompound();
terminal.setInteger( "term_width", m_terminal.getWidth() );
terminal.setInteger( "term_height", m_terminal.getHeight() );
m_terminal.writeToNBT( terminal );
nbttagcompound.setTag( "terminal", terminal );
nbt.setTag( "terminal", terminal );
}
}
}

View File

@@ -108,11 +108,11 @@ public abstract class TileGeneric extends TileEntity
player.getDistanceSq( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 ) <= (range * range);
}
protected void writeDescription( @Nonnull NBTTagCompound nbttagcompound )
protected void writeDescription( @Nonnull NBTTagCompound nbt )
{
}
protected void readDescription( @Nonnull NBTTagCompound nbttagcompound )
protected void readDescription( @Nonnull NBTTagCompound nbt )
{
}
@@ -126,24 +126,15 @@ public abstract class TileGeneric extends TileEntity
public final SPacketUpdateTileEntity getUpdatePacket()
{
// Communicate properties
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeDescription( nbttagcompound );
return new SPacketUpdateTileEntity( getPos(), 0, nbttagcompound );
NBTTagCompound nbt = new NBTTagCompound();
writeDescription( nbt );
return new SPacketUpdateTileEntity( getPos(), 0, nbt );
}
@Override
public final void onDataPacket( NetworkManager net, SPacketUpdateTileEntity packet )
{
switch( packet.getTileEntityType() )
{
case 0:
{
// Receive properties
NBTTagCompound nbttagcompound = packet.getNbtCompound();
readDescription( nbttagcompound );
break;
}
}
if( packet.getTileEntityType() == 0 ) readDescription( packet.getNbtCompound() );
}
@Nonnull