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:
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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 ) )
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user