Replaces all non constant fields with upper case name

This commit is contained in:
thatsIch
2015-05-08 22:53:50 +02:00
parent a44369a272
commit b748a1982f
10 changed files with 99 additions and 96 deletions
@@ -42,12 +42,12 @@ public class TESRWrapper extends TileEntitySpecialRenderer
public final RenderBlocks renderBlocksInstance = new RenderBlocks(); public final RenderBlocks renderBlocksInstance = new RenderBlocks();
final BaseBlockRender blkRender; final BaseBlockRender blkRender;
final double MAX_DISTANCE; private final double maxDistance;
public TESRWrapper( BaseBlockRender render ) public TESRWrapper( BaseBlockRender render )
{ {
this.blkRender = render; this.blkRender = render;
this.MAX_DISTANCE = this.blkRender.getTesrRenderDistance(); this.maxDistance = this.blkRender.getTesrRenderDistance();
} }
@Override @Override
@@ -59,7 +59,7 @@ public class TESRWrapper extends TileEntitySpecialRenderer
if( b instanceof AEBaseBlock && ( (AEBaseTile) te ).requiresTESR() ) if( b instanceof AEBaseBlock && ( (AEBaseTile) te ).requiresTESR() )
{ {
if( Math.abs( x ) > this.MAX_DISTANCE || Math.abs( y ) > this.MAX_DISTANCE || Math.abs( z ) > this.MAX_DISTANCE ) if( Math.abs( x ) > this.maxDistance || Math.abs( y ) > this.maxDistance || Math.abs( z ) > this.maxDistance )
{ {
return; return;
} }
@@ -35,8 +35,8 @@ public class LightningFX extends EntityFX
private static final Random RANDOM_GENERATOR = new Random(); private static final Random RANDOM_GENERATOR = new Random();
final int steps = this.getSteps(); final int steps = this.getSteps();
final double[][] Steps; final double[][] Steps;
final double[] I = new double[3]; private final double[] vertices = new double[3];
final double[] K = new double[3]; private final double[] verticesWithUV = new double[3];
float currentPoint = 0; float currentPoint = 0;
boolean hasData = false; boolean hasData = false;
@@ -206,15 +206,15 @@ public class LightningFX extends EntityFX
if( this.hasData ) if( this.hasData )
{ {
tess.addVertexWithUV( a[0], a[1], a[2], f6, f8 ); tess.addVertexWithUV( a[0], a[1], a[2], f6, f8 );
tess.addVertexWithUV( this.I[0], this.I[1], this.I[2], f6, f8 ); tess.addVertexWithUV( this.vertices[0], this.vertices[1], this.vertices[2], f6, f8 );
tess.addVertexWithUV( this.K[0], this.K[1], this.K[2], f6, f8 ); tess.addVertexWithUV( this.verticesWithUV[0], this.verticesWithUV[1], this.verticesWithUV[2], f6, f8 );
tess.addVertexWithUV( b[0], b[1], b[2], f6, f8 ); tess.addVertexWithUV( b[0], b[1], b[2], f6, f8 );
} }
this.hasData = true; this.hasData = true;
for( int x = 0; x < 3; x++ ) for( int x = 0; x < 3; x++ )
{ {
this.I[x] = a[x]; this.vertices[x] = a[x];
this.K[x] = b[x]; this.verticesWithUV[x] = b[x];
} }
} }
} }
@@ -21,13 +21,14 @@ package appeng.integration.modules;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import com.google.common.base.Optional;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.google.common.base.Optional;
import mods.immibis.core.api.multipart.ICoverSystem; import mods.immibis.core.api.multipart.ICoverSystem;
import mods.immibis.core.api.multipart.IMultipartTile; import mods.immibis.core.api.multipart.IMultipartTile;
import mods.immibis.core.api.multipart.IPartContainer; import mods.immibis.core.api.multipart.IPartContainer;
@@ -45,7 +46,7 @@ import appeng.integration.abstraction.IImmibisMicroblocks;
public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblocks public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblocks
{ {
@Reflected @Reflected
public static ImmibisMicroblocks INSTANCE; public static ImmibisMicroblocks instance;
private boolean canConvertTiles = false; private boolean canConvertTiles = false;
@@ -40,6 +40,7 @@ import appeng.client.gui.implementations.GuiCraftingTerm;
import appeng.client.gui.implementations.GuiPatternTerm; import appeng.client.gui.implementations.GuiPatternTerm;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.helpers.Reflected;
import appeng.integration.BaseModule; import appeng.integration.BaseModule;
import appeng.integration.abstraction.INEI; import appeng.integration.abstraction.INEI;
import appeng.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler; import appeng.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler;
@@ -54,28 +55,29 @@ import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder;
public class NEI extends BaseModule implements INEI, IContainerTooltipHandler public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
{ {
@Reflected
public static NEI instance; public static NEI instance;
Class<?> API; private final Class<?> apiClass;
// recipe handler... // recipe handler...
Method registerRecipeHandler; Method registerRecipeHandler;
Method registerUsageHandler; Method registerUsageHandler;
@Reflected
public NEI() throws ClassNotFoundException public NEI() throws ClassNotFoundException
{ {
this.testClassExistence( GuiContainerManager.class ); this.testClassExistence( GuiContainerManager.class );
this.testClassExistence( codechicken.nei.recipe.ICraftingHandler.class ); this.testClassExistence( codechicken.nei.recipe.ICraftingHandler.class );
this.testClassExistence( codechicken.nei.recipe.IUsageHandler.class ); this.testClassExistence( codechicken.nei.recipe.IUsageHandler.class );
this.API = Class.forName( "codechicken.nei.api.API" ); this.apiClass = Class.forName( "codechicken.nei.api.API" );
} }
@Override @Override
public void init() throws Throwable public void init() throws Throwable
{ {
this.registerRecipeHandler = this.API.getDeclaredMethod( "registerRecipeHandler", codechicken.nei.recipe.ICraftingHandler.class ); this.registerRecipeHandler = this.apiClass.getDeclaredMethod( "registerRecipeHandler", codechicken.nei.recipe.ICraftingHandler.class );
this.registerUsageHandler = this.API.getDeclaredMethod( "registerUsageHandler", codechicken.nei.recipe.IUsageHandler.class ); this.registerUsageHandler = this.apiClass.getDeclaredMethod( "registerUsageHandler", codechicken.nei.recipe.IUsageHandler.class );
this.registerRecipeHandler( new NEIAEShapedRecipeHandler() ); this.registerRecipeHandler( new NEIAEShapedRecipeHandler() );
this.registerRecipeHandler( new NEIAEShapelessRecipeHandler() ); this.registerRecipeHandler( new NEIAEShapelessRecipeHandler() );
@@ -92,23 +94,23 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
GuiContainerManager.addTooltipHandler( this ); GuiContainerManager.addTooltipHandler( this );
// crafting terminal... // crafting terminal...
Method registerGuiOverlay = this.API.getDeclaredMethod( "registerGuiOverlay", Class.class, String.class, IStackPositioner.class ); Method registerGuiOverlay = this.apiClass.getDeclaredMethod( "registerGuiOverlay", Class.class, String.class, IStackPositioner.class );
Class IOverlayHandler = Class.forName( "codechicken.nei.api.IOverlayHandler" ); Class IOverlayHandler = Class.forName( "codechicken.nei.api.IOverlayHandler" );
Class DefaultOverlayHandler = NEICraftingHandler.class; Class DefaultOverlayHandler = NEICraftingHandler.class;
Method registerGuiOverlayHandler = this.API.getDeclaredMethod( "registerGuiOverlayHandler", Class.class, IOverlayHandler, String.class ); Method registerGuiOverlayHandler = this.apiClass.getDeclaredMethod( "registerGuiOverlayHandler", Class.class, IOverlayHandler, String.class );
registerGuiOverlay.invoke( this.API, GuiCraftingTerm.class, "crafting", new TerminalCraftingSlotFinder() ); registerGuiOverlay.invoke( this.apiClass, GuiCraftingTerm.class, "crafting", new TerminalCraftingSlotFinder() );
registerGuiOverlay.invoke( this.API, GuiPatternTerm.class, "crafting", new TerminalCraftingSlotFinder() ); registerGuiOverlay.invoke( this.apiClass, GuiPatternTerm.class, "crafting", new TerminalCraftingSlotFinder() );
Constructor DefaultOverlayHandlerConstructor = DefaultOverlayHandler.getConstructor( int.class, int.class ); Constructor DefaultOverlayHandlerConstructor = DefaultOverlayHandler.getConstructor( int.class, int.class );
registerGuiOverlayHandler.invoke( this.API, GuiCraftingTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" ); registerGuiOverlayHandler.invoke( this.apiClass, GuiCraftingTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" );
registerGuiOverlayHandler.invoke( this.API, GuiPatternTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" ); registerGuiOverlayHandler.invoke( this.apiClass, GuiPatternTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" );
} }
public void registerRecipeHandler( Object o ) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException public void registerRecipeHandler( Object o ) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{ {
this.registerRecipeHandler.invoke( this.API, o ); this.registerRecipeHandler.invoke( this.apiClass, o );
this.registerUsageHandler.invoke( this.API, o ); this.registerUsageHandler.invoke( this.apiClass, o );
} }
@Override @Override
@@ -57,11 +57,11 @@ public class CellInventory implements ICellInventory
static final String ITEM_PRE_FORMATTED_NAME = "PN"; static final String ITEM_PRE_FORMATTED_NAME = "PN";
static final String ITEM_PRE_FORMATTED_FUZZY = "FP"; static final String ITEM_PRE_FORMATTED_FUZZY = "FP";
private static final HashSet<Integer> BLACK_LIST = new HashSet<Integer>(); private static final HashSet<Integer> BLACK_LIST = new HashSet<Integer>();
protected static String[] ITEM_SLOT_ARR; protected static String[] itemSlots;
protected static String[] ITEM_SLOT_COUNT_ARR; protected static String[] itemSlotCount;
protected final NBTTagCompound tagCompound; protected final NBTTagCompound tagCompound;
protected final ISaveProvider container; protected final ISaveProvider container;
protected int MAX_ITEM_TYPES = 63; protected int maxItemTypes = 63;
protected short storedItems = 0; protected short storedItems = 0;
protected int storedItemCount = 0; protected int storedItemCount = 0;
protected IItemList<IAEItemStack> cellItems; protected IItemList<IAEItemStack> cellItems;
@@ -76,15 +76,15 @@ public class CellInventory implements ICellInventory
protected CellInventory( ItemStack o, ISaveProvider container ) throws AppEngException protected CellInventory( ItemStack o, ISaveProvider container ) throws AppEngException
{ {
if( ITEM_SLOT_ARR == null ) if( itemSlots == null )
{ {
ITEM_SLOT_ARR = new String[this.MAX_ITEM_TYPES]; itemSlots = new String[this.maxItemTypes];
ITEM_SLOT_COUNT_ARR = new String[this.MAX_ITEM_TYPES]; itemSlotCount = new String[this.maxItemTypes];
for( int x = 0; x < this.MAX_ITEM_TYPES; x++ ) for( int x = 0; x < this.maxItemTypes; x++ )
{ {
ITEM_SLOT_ARR[x] = ITEM_SLOT + x; itemSlots[x] = ITEM_SLOT + x;
ITEM_SLOT_COUNT_ARR[x] = ITEM_SLOT_COUNT + x; itemSlotCount[x] = ITEM_SLOT_COUNT + x;
} }
} }
@@ -100,7 +100,7 @@ public class CellInventory implements ICellInventory
if( type instanceof IStorageCell ) if( type instanceof IStorageCell )
{ {
this.CellType = (IStorageCell) this.i.getItem(); this.CellType = (IStorageCell) this.i.getItem();
this.MAX_ITEM_TYPES = this.CellType.getTotalTypes( this.i ); this.maxItemTypes = this.CellType.getTotalTypes( this.i );
} }
if( this.CellType == null ) if( this.CellType == null )
@@ -113,13 +113,13 @@ public class CellInventory implements ICellInventory
throw new AppEngException( "ItemStack was used as a cell, but was not a cell!" ); throw new AppEngException( "ItemStack was used as a cell, but was not a cell!" );
} }
if( this.MAX_ITEM_TYPES > 63 ) if( this.maxItemTypes > 63 )
{ {
this.MAX_ITEM_TYPES = 63; this.maxItemTypes = 63;
} }
if( this.MAX_ITEM_TYPES < 1 ) if( this.maxItemTypes < 1 )
{ {
this.MAX_ITEM_TYPES = 1; this.maxItemTypes = 1;
} }
this.container = container; this.container = container;
@@ -366,7 +366,7 @@ public class CellInventory implements ICellInventory
{ {
itemCount += v.getStackSize(); itemCount += v.getStackSize();
NBTBase c = this.tagCompound.getTag( ITEM_SLOT_ARR[x] ); NBTBase c = this.tagCompound.getTag( itemSlots[x] );
if( c instanceof NBTTagCompound ) if( c instanceof NBTTagCompound )
{ {
v.writeToNBT( (NBTTagCompound) c ); v.writeToNBT( (NBTTagCompound) c );
@@ -375,14 +375,14 @@ public class CellInventory implements ICellInventory
{ {
NBTTagCompound g = new NBTTagCompound(); NBTTagCompound g = new NBTTagCompound();
v.writeToNBT( g ); v.writeToNBT( g );
this.tagCompound.setTag( ITEM_SLOT_ARR[x], g ); this.tagCompound.setTag( itemSlots[x], g );
} }
/* /*
* NBTBase tagSlotCount = tagCompound.getTag( ITEM_SLOT_COUNT_ARR[x] ); if ( tagSlotCount instanceof * NBTBase tagSlotCount = tagCompound.getTag( itemSlotCount[x] ); if ( tagSlotCount instanceof
* NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else * NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else
*/ */
this.tagCompound.setInteger( ITEM_SLOT_COUNT_ARR[x], (int) v.getStackSize() ); this.tagCompound.setInteger( itemSlotCount[x], (int) v.getStackSize() );
x++; x++;
} }
@@ -419,10 +419,10 @@ public class CellInventory implements ICellInventory
} }
// clean any old crusty stuff... // clean any old crusty stuff...
for(; x < oldStoredItems && x < this.MAX_ITEM_TYPES; x++ ) for(; x < oldStoredItems && x < this.maxItemTypes; x++ )
{ {
this.tagCompound.removeTag( ITEM_SLOT_ARR[x] ); this.tagCompound.removeTag( itemSlots[x] );
this.tagCompound.removeTag( ITEM_SLOT_COUNT_ARR[x] ); this.tagCompound.removeTag( itemSlotCount[x] );
} }
if( this.container != null ) if( this.container != null )
@@ -444,10 +444,10 @@ public class CellInventory implements ICellInventory
for( int x = 0; x < types; x++ ) for( int x = 0; x < types; x++ )
{ {
ItemStack t = ItemStack.loadItemStackFromNBT( this.tagCompound.getCompoundTag( ITEM_SLOT_ARR[x] ) ); ItemStack t = ItemStack.loadItemStackFromNBT( this.tagCompound.getCompoundTag( itemSlots[x] ) );
if( t != null ) if( t != null )
{ {
t.stackSize = this.tagCompound.getInteger( ITEM_SLOT_COUNT_ARR[x] ); t.stackSize = this.tagCompound.getInteger( itemSlotCount[x] );
if( t.stackSize > 0 ) if( t.stackSize > 0 )
{ {
@@ -541,7 +541,7 @@ public class CellInventory implements ICellInventory
@Override @Override
public long getTotalItemTypes() public long getTotalItemTypes()
{ {
return this.MAX_ITEM_TYPES; return this.maxItemTypes;
} }
@Override @Override
@@ -45,8 +45,8 @@ import appeng.me.GridAccessException;
public abstract class PartBasicState extends AEBasePart implements IPowerChannelState public abstract class PartBasicState extends AEBasePart implements IPowerChannelState
{ {
protected final int POWERED_FLAG = 1; protected static final int POWERED_FLAG = 1;
protected final int CHANNEL_FLAG = 2; protected static final int CHANNEL_FLAG = 2;
protected int clientFlags = 0; // sent as byte. protected int clientFlags = 0; // sent as byte.
@@ -83,7 +83,7 @@ import appeng.util.Platform;
public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherHost, IStackWatcherHost, ICraftingWatcherHost, IMEMonitorHandlerReceiver<IAEItemStack>, ICraftingProvider public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherHost, IStackWatcherHost, ICraftingWatcherHost, IMEMonitorHandlerReceiver<IAEItemStack>, ICraftingProvider
{ {
final int FLAG_ON = 4; private static final int FLAG_ON = 4;
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 1 ); final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 1 );
@@ -53,7 +53,7 @@ import appeng.util.Platform;
public class PartToggleBus extends PartBasicState public class PartToggleBus extends PartBasicState
{ {
protected final int REDSTONE_FLAG = 4; private static final int REDSTONE_FLAG = 4;
final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true ); final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
IGridConnection connection; IGridConnection connection;
boolean hasRedstone = false; boolean hasRedstone = false;
@@ -53,9 +53,9 @@ import appeng.util.Platform;
public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChannelState public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChannelState
{ {
final int POWERED_FLAG = 4; protected static final int POWERED_FLAG = 4;
final int BOOTING_FLAG = 8; protected static final int CHANNEL_FLAG = 16;
final int CHANNEL_FLAG = 16; private static final int BOOTING_FLAG = 8;
// CableBusTextures frontSolid = CableBusTextures.PartMonitor_Solid; // CableBusTextures frontSolid = CableBusTextures.PartMonitor_Solid;
CableBusTextures frontDark = CableBusTextures.PartMonitor_Colored; CableBusTextures frontDark = CableBusTextures.PartMonitor_Colored;
CableBusTextures frontBright = CableBusTextures.PartMonitor_Bright; CableBusTextures frontBright = CableBusTextures.PartMonitor_Bright;
@@ -197,37 +197,6 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
} }
} }
private int blockLight( int emit )
{
if( this.opacity < 0 )
{
TileEntity te = this.getTile();
this.opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
}
return (int) ( emit * ( this.opacity / 255.0f ) );
}
@Override
public boolean isPowered()
{
try
{
if( Platform.isServer() )
{
return this.proxy.getEnergy().isNetworkPowered();
}
else
{
return ( ( this.clientFlags & this.POWERED_FLAG ) == this.POWERED_FLAG );
}
}
catch( GridAccessException e )
{
return false;
}
}
@Override @Override
public void onNeighborChanged() public void onNeighborChanged()
{ {
@@ -362,6 +331,37 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
} }
} }
private int blockLight( int emit )
{
if( this.opacity < 0 )
{
TileEntity te = this.getTile();
this.opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
}
return (int) ( emit * ( this.opacity / 255.0f ) );
}
@Override
public boolean isPowered()
{
try
{
if( Platform.isServer() )
{
return this.proxy.getEnergy().isNetworkPowered();
}
else
{
return ( ( this.clientFlags & this.POWERED_FLAG ) == this.POWERED_FLAG );
}
}
catch( GridAccessException e )
{
return false;
}
}
@Override @Override
public boolean isActive() public boolean isActive()
{ {
@@ -43,17 +43,17 @@ import appeng.tile.grid.AENetworkTile;
public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
{ {
public final int DISPLAY_END_MIN = 0x01; public static final int DISPLAY_END_MIN = 0x01;
public final int DISPLAY_END_MAX = 0x02; public static final int DISPLAY_END_MAX = 0x02;
public final int DISPLAY_MIDDLE = 0x01 + 0x02; public static final int DISPLAY_MIDDLE = 0x01 + 0x02;
public final int DISPLAY_X = 0x04; public static final int DISPLAY_X = 0x04;
public final int DISPLAY_Y = 0x08; public static final int DISPLAY_Y = 0x08;
public final int DISPLAY_Z = 0x04 + 0x08; public static final int DISPLAY_Z = 0x04 + 0x08;
public final int MB_STATUS = 0x01 + 0x02 + 0x04 + 0x08; public static final int MB_STATUS = 0x01 + 0x02 + 0x04 + 0x08;
public final int DISPLAY_ENABLED = 0x10; public static final int DISPLAY_ENABLED = 0x10;
public final int DISPLAY_POWERED_ENABLED = 0x20; public static final int DISPLAY_POWERED_ENABLED = 0x20;
public final int NET_STATUS = 0x10 + 0x20; public static final int NET_STATUS = 0x10 + 0x20;
final SpatialPylonCalculator calc = new SpatialPylonCalculator( this ); final SpatialPylonCalculator calc = new SpatialPylonCalculator( this );
int displayBits = 0; int displayBits = 0;
SpatialPylonCluster cluster; SpatialPylonCluster cluster;