final variables and parameters
This commit is contained in:
@@ -32,28 +32,28 @@ public class CompassManager
|
||||
public static final CompassManager INSTANCE = new CompassManager();
|
||||
final HashMap<CompassRequest, CompassResult> requests = new HashMap<CompassRequest, CompassResult>();
|
||||
|
||||
public void postResult( long attunement, int x, int y, int z, CompassResult result )
|
||||
public void postResult( final long attunement, final int x, final int y, final int z, final CompassResult result )
|
||||
{
|
||||
CompassRequest r = new CompassRequest( attunement, x, y, z );
|
||||
final CompassRequest r = new CompassRequest( attunement, x, y, z );
|
||||
this.requests.put( r, result );
|
||||
}
|
||||
|
||||
public CompassResult getCompassDirection( long attunement, int x, int y, int z )
|
||||
public CompassResult getCompassDirection( final long attunement, final int x, final int y, final int z )
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
final long now = System.currentTimeMillis();
|
||||
|
||||
Iterator<CompassResult> i = this.requests.values().iterator();
|
||||
final Iterator<CompassResult> i = this.requests.values().iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
CompassResult res = i.next();
|
||||
long diff = now - res.time;
|
||||
final CompassResult res = i.next();
|
||||
final long diff = now - res.time;
|
||||
if( diff > 20000 )
|
||||
{
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
|
||||
CompassRequest r = new CompassRequest( attunement, x, y, z );
|
||||
final CompassRequest r = new CompassRequest( attunement, x, y, z );
|
||||
CompassResult res = this.requests.get( r );
|
||||
|
||||
if( res == null )
|
||||
@@ -74,7 +74,7 @@ public class CompassManager
|
||||
return res;
|
||||
}
|
||||
|
||||
private void requestUpdate( CompassRequest r )
|
||||
private void requestUpdate( final CompassRequest r )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketCompassRequest( r.attunement, r.cx, r.cz, r.cdy ) );
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class CompassManager
|
||||
final int cdy;
|
||||
final int cz;
|
||||
|
||||
public CompassRequest( long attunement, int x, int y, int z )
|
||||
public CompassRequest( final long attunement, final int x, final int y, final int z )
|
||||
{
|
||||
this.attunement = attunement;
|
||||
this.cx = x >> 4;
|
||||
@@ -105,7 +105,7 @@ public class CompassManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
public boolean equals( final Object obj )
|
||||
{
|
||||
if( obj == null )
|
||||
{
|
||||
@@ -115,7 +115,7 @@ public class CompassManager
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CompassRequest other = (CompassRequest) obj;
|
||||
final CompassRequest other = (CompassRequest) obj;
|
||||
return this.attunement == other.attunement && this.cx == other.cx && this.cdy == other.cdy && this.cz == other.cz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class CompassResult
|
||||
|
||||
public boolean requested = false;
|
||||
|
||||
public CompassResult( boolean hasResult, boolean spin, double rad )
|
||||
public CompassResult( final boolean hasResult, final boolean spin, final double rad )
|
||||
{
|
||||
this.hasResult = hasResult;
|
||||
this.spin = spin;
|
||||
|
||||
@@ -32,14 +32,14 @@ public final class DispenserBehaviorTinyTNT extends BehaviorDefaultDispenseItem
|
||||
{
|
||||
|
||||
@Override
|
||||
protected ItemStack dispenseStack( IBlockSource dispenser, ItemStack dispensedItem )
|
||||
protected ItemStack dispenseStack( final IBlockSource dispenser, final ItemStack dispensedItem )
|
||||
{
|
||||
EnumFacing enumfacing = BlockDispenser.getFacing( dispenser.getBlockMetadata() );
|
||||
World world = dispenser.getWorld();
|
||||
int i = dispenser.getBlockPos().getX() + enumfacing.getFrontOffsetX();
|
||||
int j = dispenser.getBlockPos().getY() + enumfacing.getFrontOffsetY();
|
||||
int k = dispenser.getBlockPos().getZ() + enumfacing.getFrontOffsetZ();
|
||||
EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( world, i + 0.5F, j + 0.5F, k + 0.5F, null );
|
||||
final EnumFacing enumfacing = BlockDispenser.getFacing( dispenser.getBlockMetadata() );
|
||||
final World world = dispenser.getWorld();
|
||||
final int i = dispenser.getBlockPos().getX() + enumfacing.getFrontOffsetX();
|
||||
final int j = dispenser.getBlockPos().getY() + enumfacing.getFrontOffsetY();
|
||||
final int k = dispenser.getBlockPos().getZ() + enumfacing.getFrontOffsetZ();
|
||||
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( world, i + 0.5F, j + 0.5F, k + 0.5F, null );
|
||||
world.spawnEntityInWorld( primedTinyTNTEntity );
|
||||
--dispensedItem.stackSize;
|
||||
return dispensedItem;
|
||||
|
||||
@@ -34,15 +34,15 @@ public final class DispenserBlockTool extends BehaviorDefaultDispenseItem
|
||||
{
|
||||
|
||||
@Override
|
||||
protected ItemStack dispenseStack( IBlockSource dispenser, ItemStack dispensedItem )
|
||||
protected ItemStack dispenseStack( final IBlockSource dispenser, final ItemStack dispensedItem )
|
||||
{
|
||||
Item i = dispensedItem.getItem();
|
||||
final Item i = dispensedItem.getItem();
|
||||
if( i instanceof IBlockTool )
|
||||
{
|
||||
EnumFacing enumfacing = BlockDispenser.getFacing( dispenser.getBlockMetadata() );
|
||||
IBlockTool tm = (IBlockTool) i;
|
||||
final EnumFacing enumfacing = BlockDispenser.getFacing( dispenser.getBlockMetadata() );
|
||||
final IBlockTool tm = (IBlockTool) i;
|
||||
|
||||
World w = dispenser.getWorld();
|
||||
final World w = dispenser.getWorld();
|
||||
if( w instanceof WorldServer )
|
||||
{
|
||||
tm.onItemUse( dispensedItem, Platform.getPlayer( (WorldServer) w ), w, dispenser.getBlockPos().offset( enumfacing ), enumfacing, 0.5f, 0.5f, 0.5f );
|
||||
|
||||
@@ -37,14 +37,14 @@ public final class DispenserMatterCannon extends BehaviorDefaultDispenseItem
|
||||
{
|
||||
|
||||
@Override
|
||||
protected ItemStack dispenseStack( IBlockSource dispenser, ItemStack dispensedItem )
|
||||
protected ItemStack dispenseStack( final IBlockSource dispenser, ItemStack dispensedItem )
|
||||
{
|
||||
Item i = dispensedItem.getItem();
|
||||
final Item i = dispensedItem.getItem();
|
||||
if( i instanceof ToolMassCannon )
|
||||
{
|
||||
EnumFacing enumfacing = BlockDispenser.getFacing( dispenser.getBlockMetadata() );
|
||||
final EnumFacing enumfacing = BlockDispenser.getFacing( dispenser.getBlockMetadata() );
|
||||
AEPartLocation dir = AEPartLocation.INTERNAL;
|
||||
for( AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
|
||||
for( final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
if( enumfacing.getFrontOffsetX() == d.xOffset && enumfacing.getFrontOffsetY() == d.yOffset && enumfacing.getFrontOffsetZ() == d.zOffset )
|
||||
{
|
||||
@@ -52,12 +52,12 @@ public final class DispenserMatterCannon extends BehaviorDefaultDispenseItem
|
||||
}
|
||||
}
|
||||
|
||||
ToolMassCannon tm = (ToolMassCannon) i;
|
||||
final ToolMassCannon tm = (ToolMassCannon) i;
|
||||
|
||||
World w = dispenser.getWorld();
|
||||
final World w = dispenser.getWorld();
|
||||
if( w instanceof WorldServer )
|
||||
{
|
||||
EntityPlayer p = Platform.getPlayer( (WorldServer) w );
|
||||
final EntityPlayer p = Platform.getPlayer( (WorldServer) w );
|
||||
Platform.configurePlayer( p, dir, dispenser.getBlockTileEntity() );
|
||||
|
||||
p.posX += dir.xOffset;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TickHandler
|
||||
return this.cliPlayerColors;
|
||||
}
|
||||
|
||||
public void addCallable( World w, IWorldCallable<?> c )
|
||||
public void addCallable( final World w, final IWorldCallable<?> c )
|
||||
{
|
||||
if( w == null )
|
||||
{
|
||||
@@ -97,7 +97,7 @@ public class TickHandler
|
||||
}
|
||||
}
|
||||
|
||||
public void addInit( AEBaseTile tile )
|
||||
public void addInit( final AEBaseTile tile )
|
||||
{
|
||||
if( Platform.isServer() ) // for no there is no reason to care about this on the client...
|
||||
{
|
||||
@@ -114,7 +114,7 @@ public class TickHandler
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public void addNetwork( Grid grid )
|
||||
public void addNetwork( final Grid grid )
|
||||
{
|
||||
if( Platform.isServer() ) // for no there is no reason to care about this on the client...
|
||||
{
|
||||
@@ -122,7 +122,7 @@ public class TickHandler
|
||||
}
|
||||
}
|
||||
|
||||
public void removeNetwork( Grid grid )
|
||||
public void removeNetwork( final Grid grid )
|
||||
{
|
||||
if( Platform.isServer() ) // for no there is no reason to care about this on the client...
|
||||
{
|
||||
@@ -141,15 +141,15 @@ public class TickHandler
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void unloadWorld( WorldEvent.Unload ev )
|
||||
public void unloadWorld( final WorldEvent.Unload ev )
|
||||
{
|
||||
if( Platform.isServer() ) // for no there is no reason to care about this on the client...
|
||||
{
|
||||
LinkedList<IGridNode> toDestroy = new LinkedList<IGridNode>();
|
||||
final LinkedList<IGridNode> toDestroy = new LinkedList<IGridNode>();
|
||||
|
||||
for( Grid g : this.getRepo().networks )
|
||||
for( final Grid g : this.getRepo().networks )
|
||||
{
|
||||
for( IGridNode n : g.getNodes() )
|
||||
for( final IGridNode n : g.getNodes() )
|
||||
{
|
||||
if( n.getWorld() == ev.world )
|
||||
{
|
||||
@@ -158,7 +158,7 @@ public class TickHandler
|
||||
}
|
||||
}
|
||||
|
||||
for( IGridNode n : toDestroy )
|
||||
for( final IGridNode n : toDestroy )
|
||||
{
|
||||
n.destroy();
|
||||
}
|
||||
@@ -166,9 +166,9 @@ public class TickHandler
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkLoad( ChunkEvent.Load load )
|
||||
public void onChunkLoad( final ChunkEvent.Load load )
|
||||
{
|
||||
for( Object te : load.getChunk().getTileEntityMap().values() )
|
||||
for( final Object te : load.getChunk().getTileEntityMap().values() )
|
||||
{
|
||||
if( te instanceof AEBaseTile )
|
||||
{
|
||||
@@ -178,13 +178,13 @@ public class TickHandler
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick( TickEvent ev )
|
||||
public void onTick( final TickEvent ev )
|
||||
{
|
||||
|
||||
if( ev.type == Type.CLIENT && ev.phase == Phase.START )
|
||||
{
|
||||
this.tickColors( this.cliPlayerColors );
|
||||
CableRenderMode currentMode = AEApi.instance().partHelper().getCableRenderMode();
|
||||
final CableRenderMode currentMode = AEApi.instance().partHelper().getCableRenderMode();
|
||||
if( currentMode != this.crm )
|
||||
{
|
||||
this.crm = currentMode;
|
||||
@@ -194,17 +194,17 @@ public class TickHandler
|
||||
|
||||
if( ev.type == Type.WORLD && ev.phase == Phase.END )
|
||||
{
|
||||
WorldTickEvent wte = (WorldTickEvent) ev;
|
||||
final WorldTickEvent wte = (WorldTickEvent) ev;
|
||||
synchronized( this.craftingJobs )
|
||||
{
|
||||
Collection<CraftingJob> jobSet = this.craftingJobs.get( wte.world );
|
||||
final Collection<CraftingJob> jobSet = this.craftingJobs.get( wte.world );
|
||||
if( !jobSet.isEmpty() )
|
||||
{
|
||||
int simTime = Math.max( 1, AEConfig.instance.craftingCalculationTimePerTick / jobSet.size() );
|
||||
Iterator<CraftingJob> i = jobSet.iterator();
|
||||
final int simTime = Math.max( 1, AEConfig.instance.craftingCalculationTimePerTick / jobSet.size() );
|
||||
final Iterator<CraftingJob> i = jobSet.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
CraftingJob cj = i.next();
|
||||
final CraftingJob cj = i.next();
|
||||
if( !cj.simulateFor( simTime ) )
|
||||
{
|
||||
i.remove();
|
||||
@@ -219,10 +219,10 @@ public class TickHandler
|
||||
{
|
||||
this.tickColors( this.srvPlayerColors );
|
||||
// ready tiles.
|
||||
HandlerRep repo = this.getRepo();
|
||||
final HandlerRep repo = this.getRepo();
|
||||
while( !repo.tiles.isEmpty() )
|
||||
{
|
||||
AEBaseTile bt = repo.tiles.poll();
|
||||
final AEBaseTile bt = repo.tiles.poll();
|
||||
if( !bt.isInvalid() )
|
||||
{
|
||||
bt.onReady();
|
||||
@@ -230,7 +230,7 @@ public class TickHandler
|
||||
}
|
||||
|
||||
// tick networks.
|
||||
for( Grid g : this.getRepo().networks )
|
||||
for( final Grid g : this.getRepo().networks )
|
||||
{
|
||||
g.update();
|
||||
}
|
||||
@@ -248,12 +248,12 @@ public class TickHandler
|
||||
}
|
||||
}
|
||||
|
||||
private void tickColors( HashMap<Integer, PlayerColor> playerSet )
|
||||
private void tickColors( final HashMap<Integer, PlayerColor> playerSet )
|
||||
{
|
||||
Iterator<PlayerColor> i = playerSet.values().iterator();
|
||||
final Iterator<PlayerColor> i = playerSet.values().iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
PlayerColor pc = i.next();
|
||||
final PlayerColor pc = i.next();
|
||||
if( pc.ticksLeft <= 0 )
|
||||
{
|
||||
i.remove();
|
||||
@@ -262,14 +262,14 @@ public class TickHandler
|
||||
}
|
||||
}
|
||||
|
||||
private void processQueue( Queue<IWorldCallable<?>> queue, World world )
|
||||
private void processQueue( final Queue<IWorldCallable<?>> queue, final World world )
|
||||
{
|
||||
if( queue == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Stopwatch sw = Stopwatch.createStarted();
|
||||
final Stopwatch sw = Stopwatch.createStarted();
|
||||
|
||||
IWorldCallable<?> c = null;
|
||||
while( ( c = queue.poll() ) != null )
|
||||
@@ -283,7 +283,7 @@ public class TickHandler
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
@@ -294,7 +294,7 @@ public class TickHandler
|
||||
// AELog.info( "processQueue Time: " + time + "ms" );
|
||||
}
|
||||
|
||||
public void registerCraftingSimulation( World world, CraftingJob craftingJob )
|
||||
public void registerCraftingSimulation( final World world, final CraftingJob craftingJob )
|
||||
{
|
||||
synchronized( this.craftingJobs )
|
||||
{
|
||||
@@ -324,7 +324,7 @@ public class TickHandler
|
||||
protected final int myEntity;
|
||||
protected int ticksLeft;
|
||||
|
||||
public PlayerColor( int id, AEColor col, int ticks )
|
||||
public PlayerColor( final int id, final AEColor col, final int ticks )
|
||||
{
|
||||
this.myEntity = id;
|
||||
this.myColor = col;
|
||||
|
||||
Reference in New Issue
Block a user