1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-12 02:10:30 +00:00

Make many fields final

This commit is contained in:
SquidDev 2017-05-07 01:52:55 +01:00
parent a3400ecf26
commit 5a60818c99
14 changed files with 34 additions and 60 deletions

View File

@ -17,8 +17,8 @@ import java.util.*;
public class HTTPAPI implements ILuaAPI public class HTTPAPI implements ILuaAPI
{ {
private IAPIEnvironment m_apiEnvironment; private final IAPIEnvironment m_apiEnvironment;
private List<HTTPRequest> m_httpRequests; private final List<HTTPRequest> m_httpRequests;
public HTTPAPI( IAPIEnvironment environment ) public HTTPAPI( IAPIEnvironment environment )
{ {

View File

@ -278,8 +278,8 @@ public class HTTPRequest
return null; return null;
} }
private Object m_lock = new Object(); private final Object m_lock = new Object();
private URL m_url; private final URL m_url;
private final String m_urlString; private final String m_urlString;
private boolean m_complete; private boolean m_complete;

View File

@ -235,9 +235,9 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
} }
} }
private IAPIEnvironment m_environment; private final IAPIEnvironment m_environment;
private FileSystem m_fileSystem; private FileSystem m_fileSystem;
private PeripheralWrapper[] m_peripherals; private final PeripheralWrapper[] m_peripherals;
private boolean m_running; private boolean m_running;
public PeripheralAPI( IAPIEnvironment _environment ) public PeripheralAPI( IAPIEnvironment _environment )

View File

@ -15,8 +15,8 @@ import javax.annotation.Nonnull;
public class TermAPI implements ILuaAPI public class TermAPI implements ILuaAPI
{ {
private Terminal m_terminal; private final Terminal m_terminal;
private IComputerEnvironment m_environment; private final IComputerEnvironment m_environment;
public TermAPI( IAPIEnvironment _environment ) public TermAPI( IAPIEnvironment _environment )
{ {

View File

@ -186,26 +186,26 @@ public class Computer
private boolean m_blinking; private boolean m_blinking;
private ILuaMachine m_machine; private ILuaMachine m_machine;
private List<ILuaAPI> m_apis; private final List<ILuaAPI> m_apis;
private APIEnvironment m_apiEnvironment; private final APIEnvironment m_apiEnvironment;
private Terminal m_terminal; private final Terminal m_terminal;
private FileSystem m_fileSystem; private FileSystem m_fileSystem;
private IWritableMount m_rootMount; private IWritableMount m_rootMount;
private int[] m_internalOutput; private final int[] m_internalOutput;
private int[] m_internalBundledOutput; private final int[] m_internalBundledOutput;
private boolean m_internalOutputChanged; private boolean m_internalOutputChanged;
private int[] m_externalOutput; private final int[] m_externalOutput;
private int[] m_externalBundledOutput; private final int[] m_externalBundledOutput;
private boolean m_externalOutputChanged; private boolean m_externalOutputChanged;
private int[] m_input; private final int[] m_input;
private int[] m_bundledInput; private final int[] m_bundledInput;
private boolean m_inputChanged; private boolean m_inputChanged;
private IPeripheral[] m_peripherals; private final IPeripheral[] m_peripherals;
public Computer( IComputerEnvironment environment, Terminal terminal, int id ) public Computer( IComputerEnvironment environment, Terminal terminal, int id )
{ {

View File

@ -13,14 +13,14 @@ import java.util.concurrent.LinkedBlockingQueue;
public class ComputerThread public class ComputerThread
{ {
private static Object m_lock; private static final Object m_lock;
private static Thread m_thread; private static Thread m_thread;
private static WeakHashMap <Object, LinkedBlockingQueue<ITask>> m_computerTasks; private static final WeakHashMap <Object, LinkedBlockingQueue<ITask>> m_computerTasks;
private static ArrayList <LinkedBlockingQueue<ITask>> m_computerTasksActive; private static final ArrayList <LinkedBlockingQueue<ITask>> m_computerTasksActive;
private static ArrayList <LinkedBlockingQueue<ITask>> m_computerTasksPending; private static final ArrayList <LinkedBlockingQueue<ITask>> m_computerTasksPending;
private static Object m_defaultQueue; private static final Object m_defaultQueue;
private static Object m_monitor; private static final Object m_monitor;
private static boolean m_running; private static boolean m_running;
private static boolean m_stopped; private static boolean m_stopped;

View File

@ -84,7 +84,7 @@ public abstract class ModemPeripheral
private INetwork m_network; private INetwork m_network;
private IComputerAccess m_computer; private IComputerAccess m_computer;
private Map<Integer, IReceiver> m_channels; private final Map<Integer, IReceiver> m_channels;
private boolean m_open; private boolean m_open;
private boolean m_changed; private boolean m_changed;

View File

@ -233,13 +233,13 @@ public class TileCable extends TileModemBase
// Members // Members
private Map<Integer, Set<IReceiver>> m_receivers; private final Map<Integer, Set<IReceiver>> m_receivers;
private Queue<Packet> m_transmitQueue; private final Queue<Packet> m_transmitQueue;
private boolean m_peripheralAccessAllowed; private boolean m_peripheralAccessAllowed;
private int m_attachedPeripheralID; private int m_attachedPeripheralID;
private Map<String, IPeripheral> m_peripheralsByName; private final Map<String, IPeripheral> m_peripheralsByName;
private Map<String, RemotePeripheralWrapper> m_peripheralWrappersByName; private Map<String, RemotePeripheralWrapper> m_peripheralWrappersByName;
private boolean m_peripheralsKnown; private boolean m_peripheralsKnown;
private boolean m_destroyed; private boolean m_destroyed;

View File

@ -447,16 +447,8 @@ public class TilePrinter extends TilePeripheralBase
{ {
synchronized( m_inventory ) synchronized( m_inventory )
{ {
ItemStack inkStack = m_inventory[0]; ItemStack inkStack = m_inventory[ 0 ];
if( inkStack == null || !isInk(inkStack) ) return inkStack != null && isInk( inkStack ) && getPaperLevel() > 0;
{
return false;
}
if( getPaperLevel() > 0 )
{
return true;
}
return false;
} }
} }

View File

@ -52,10 +52,6 @@ public class PocketModemPeripheral extends WirelessModemPeripheral
@Override @Override
public boolean equals( IPeripheral other ) public boolean equals( IPeripheral other )
{ {
if( other instanceof PocketModemPeripheral ) return other instanceof PocketModemPeripheral;
{
return true;
}
return false;
} }
} }

View File

@ -112,7 +112,6 @@ public abstract class CCTurtleProxyCommon implements ICCTurtleProxy
} }
catch( Exception e ) catch( Exception e )
{ {
continue;
} }
} }
return null; return null;

View File

@ -245,11 +245,7 @@ public class TileTurtle extends TileComputerBase
} }
else else
{ {
if( exploder != null && ( exploder instanceof EntityLivingBase || exploder instanceof EntityFireball ) ) return exploder != null && (exploder instanceof EntityLivingBase || exploder instanceof EntityFireball);
{
return true;
}
return false;
} }
} }
@ -705,11 +701,7 @@ public class TileTurtle extends TileComputerBase
case 5: upgrade = getUpgrade( TurtleSide.Left ); break; case 5: upgrade = getUpgrade( TurtleSide.Left ); break;
default: return false; default: return false;
} }
if( upgrade != null && upgrade.getType().isPeripheral() ) return upgrade != null && upgrade.getType().isPeripheral();
{
return true;
}
return false;
} }
public void transferStateFrom( TileTurtle copy ) public void transferStateFrom( TileTurtle copy )

View File

@ -140,11 +140,7 @@ public class TurtleTool implements ITurtleUpgrade
{ {
IBlockState state = world.getBlockState( pos ); IBlockState state = world.getBlockState( pos );
Block block = state.getBlock(); Block block = state.getBlock();
if( block.isAir( state, world, pos ) || block == Blocks.BEDROCK || state.getBlockHardness( world, pos ) <= -1.0F ) return !block.isAir( state, world, pos ) && block != Blocks.BEDROCK && state.getBlockHardness( world, pos ) > -1.0F;
{
return false;
}
return true;
} }
protected boolean canHarvestBlock( World world, BlockPos pos ) protected boolean canHarvestBlock( World world, BlockPos pos )

View File

@ -50,7 +50,6 @@ public class IDAssigner
} }
catch( NumberFormatException e ) catch( NumberFormatException e )
{ {
continue;
} }
} }
} }