Reduces visibility of internal fields/methods
Reduces the visibility of all fields to private and create setters/getters when necessary. Exceptions are fields with GuiSync as these need to be public. Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
@@ -145,16 +145,16 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, this.craftMatrix );
|
||||
this.onCrafting(stack);
|
||||
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
|
||||
final InventoryCrafting ic = new InventoryCrafting( this.myContainer, 3, 3 );
|
||||
|
||||
final InventoryCrafting ic = new InventoryCrafting( this.getContainer(), 3, 3 );
|
||||
|
||||
for ( int x=0; x < this.craftMatrix.getSizeInventory(); x++ )
|
||||
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
|
||||
|
||||
|
||||
final ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(ic, playerIn.worldObj);
|
||||
|
||||
|
||||
for ( int x=0; x < this.craftMatrix.getSizeInventory(); x++ )
|
||||
this.craftMatrix.setInventorySlotContents( x, ic.getStackInSlot( x ) );
|
||||
|
||||
|
||||
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null);
|
||||
|
||||
for (int i = 0; i < aitemstack.length; ++i)
|
||||
|
||||
@@ -30,26 +30,26 @@ import appeng.tile.inventory.AppEngInternalInventory;
|
||||
public class AppEngSlot extends Slot
|
||||
{
|
||||
|
||||
public final int defX;
|
||||
public final int defY;
|
||||
public boolean isDraggable = true;
|
||||
public boolean isPlayerSide = false;
|
||||
public AEBaseContainer myContainer = null;
|
||||
public int IIcon = -1;
|
||||
public hasCalculatedValidness isValid;
|
||||
public boolean isDisplay = false;
|
||||
private final int defX;
|
||||
private final int defY;
|
||||
private boolean isDraggable = true;
|
||||
private boolean isPlayerSide = false;
|
||||
private AEBaseContainer myContainer = null;
|
||||
private int IIcon = -1;
|
||||
private hasCalculatedValidness isValid;
|
||||
private boolean isDisplay = false;
|
||||
|
||||
public AppEngSlot( final IInventory inv, final int idx, final int x, final int y )
|
||||
{
|
||||
super( inv, idx, x, y );
|
||||
this.defX = x;
|
||||
this.defY = y;
|
||||
this.isValid = hasCalculatedValidness.NotAvailable;
|
||||
this.setIsValid( hasCalculatedValidness.NotAvailable );
|
||||
}
|
||||
|
||||
public Slot setNotDraggable()
|
||||
{
|
||||
this.isDraggable = false;
|
||||
this.setDraggable( false );
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ public class AppEngSlot extends Slot
|
||||
return null;
|
||||
}
|
||||
|
||||
if( this.isDisplay )
|
||||
if( this.isDisplay() )
|
||||
{
|
||||
this.isDisplay = false;
|
||||
this.setDisplay( false );
|
||||
return this.getDisplayStack();
|
||||
}
|
||||
return super.getStack();
|
||||
@@ -107,9 +107,9 @@ public class AppEngSlot extends Slot
|
||||
{
|
||||
super.putStack( par1ItemStack );
|
||||
|
||||
if( this.myContainer != null )
|
||||
if( this.getContainer() != null )
|
||||
{
|
||||
this.myContainer.onSlotChange( this );
|
||||
this.getContainer().onSlotChange( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class AppEngSlot extends Slot
|
||||
super.onSlotChanged();
|
||||
}
|
||||
|
||||
this.isValid = hasCalculatedValidness.NotAvailable;
|
||||
this.setIsValid( hasCalculatedValidness.NotAvailable );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,7 +167,7 @@ public class AppEngSlot extends Slot
|
||||
|
||||
public int getIcon()
|
||||
{
|
||||
return this.IIcon;
|
||||
return this.getIIcon();
|
||||
}
|
||||
|
||||
public boolean isPlayerSide()
|
||||
@@ -180,6 +180,71 @@ public class AppEngSlot extends Slot
|
||||
return this.isEnabled();
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return this.defX;
|
||||
}
|
||||
|
||||
public int getY()
|
||||
{
|
||||
return this.defY;
|
||||
}
|
||||
|
||||
private int getIIcon()
|
||||
{
|
||||
return this.IIcon;
|
||||
}
|
||||
|
||||
public void setIIcon( final int iIcon )
|
||||
{
|
||||
this.IIcon = iIcon;
|
||||
}
|
||||
|
||||
private boolean isDisplay()
|
||||
{
|
||||
return this.isDisplay;
|
||||
}
|
||||
|
||||
public void setDisplay( final boolean isDisplay )
|
||||
{
|
||||
this.isDisplay = isDisplay;
|
||||
}
|
||||
|
||||
public boolean isDraggable()
|
||||
{
|
||||
return this.isDraggable;
|
||||
}
|
||||
|
||||
private void setDraggable( final boolean isDraggable )
|
||||
{
|
||||
this.isDraggable = isDraggable;
|
||||
}
|
||||
|
||||
void setPlayerSide( final boolean isPlayerSide )
|
||||
{
|
||||
this.isPlayerSide = isPlayerSide;
|
||||
}
|
||||
|
||||
public hasCalculatedValidness getIsValid()
|
||||
{
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
public void setIsValid( final hasCalculatedValidness isValid )
|
||||
{
|
||||
this.isValid = isValid;
|
||||
}
|
||||
|
||||
AEBaseContainer getContainer()
|
||||
{
|
||||
return this.myContainer;
|
||||
}
|
||||
|
||||
public void setContainer( final AEBaseContainer myContainer )
|
||||
{
|
||||
this.myContainer = myContainer;
|
||||
}
|
||||
|
||||
public enum hasCalculatedValidness
|
||||
{
|
||||
NotAvailable, Valid, Invalid
|
||||
|
||||
@@ -26,19 +26,17 @@ import net.minecraft.item.ItemStack;
|
||||
public class OptionalSlotFake extends SlotFake
|
||||
{
|
||||
|
||||
public final int srcX;
|
||||
public final int srcY;
|
||||
final int invSlot;
|
||||
final int groupNum;
|
||||
final IOptionalSlotHost host;
|
||||
public boolean renderDisabled = true;
|
||||
private final int srcX;
|
||||
private final int srcY;
|
||||
private final int groupNum;
|
||||
private final IOptionalSlotHost host;
|
||||
private boolean renderDisabled = true;
|
||||
|
||||
public OptionalSlotFake( final IInventory inv, final IOptionalSlotHost containerBus, final int idx, final int x, final int y, final int offX, final int offY, final int groupNum )
|
||||
{
|
||||
super( inv, idx, x + offX * 18, y + offY * 18 );
|
||||
this.srcX = x;
|
||||
this.srcY = y;
|
||||
this.invSlot = idx;
|
||||
this.groupNum = groupNum;
|
||||
this.host = containerBus;
|
||||
}
|
||||
@@ -69,7 +67,27 @@ public class OptionalSlotFake extends SlotFake
|
||||
}
|
||||
|
||||
public boolean renderDisabled()
|
||||
{
|
||||
return this.isRenderDisabled();
|
||||
}
|
||||
|
||||
private boolean isRenderDisabled()
|
||||
{
|
||||
return this.renderDisabled;
|
||||
}
|
||||
|
||||
public void setRenderDisabled( final boolean renderDisabled )
|
||||
{
|
||||
this.renderDisabled = renderDisabled;
|
||||
}
|
||||
|
||||
public int getSourceX()
|
||||
{
|
||||
return this.srcX;
|
||||
}
|
||||
|
||||
public int getSourceY()
|
||||
{
|
||||
return this.srcY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ import net.minecraft.inventory.IInventory;
|
||||
public class OptionalSlotNormal extends AppEngSlot
|
||||
{
|
||||
|
||||
final int groupNum;
|
||||
final IOptionalSlotHost host;
|
||||
private final int groupNum;
|
||||
private final IOptionalSlotHost host;
|
||||
|
||||
public OptionalSlotNormal( final IInventory inv, final IOptionalSlotHost containerBus, final int slot, final int xPos, final int yPos, final int groupNum )
|
||||
{
|
||||
|
||||
@@ -26,8 +26,8 @@ import net.minecraft.inventory.IInventory;
|
||||
public class OptionalSlotRestrictedInput extends SlotRestrictedInput
|
||||
{
|
||||
|
||||
final int groupNum;
|
||||
final IOptionalSlotHost host;
|
||||
private final int groupNum;
|
||||
private final IOptionalSlotHost host;
|
||||
|
||||
public OptionalSlotRestrictedInput( final PlacableItemType valid, final IInventory i, final IOptionalSlotHost host, final int slotIndex, final int x, final int y, final int grpNum, final InventoryPlayer invPlayer )
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.item.ItemStack;
|
||||
public class SlotCraftingMatrix extends AppEngSlot
|
||||
{
|
||||
|
||||
final Container c;
|
||||
private final Container c;
|
||||
|
||||
public SlotCraftingMatrix( final Container c, final IInventory par1iInventory, final int par2, final int par3, final int par4 )
|
||||
{
|
||||
|
||||
@@ -49,8 +49,8 @@ import appeng.util.item.AEItemStack;
|
||||
public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
{
|
||||
|
||||
protected final IInventory craftInv;
|
||||
protected final IInventory pattern;
|
||||
private final IInventory craftInv;
|
||||
private final IInventory pattern;
|
||||
|
||||
private final BaseActionSource mySrc;
|
||||
private final IEnergySource energySrc;
|
||||
@@ -147,19 +147,19 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
}
|
||||
}
|
||||
|
||||
protected int capCraftingAttempts( final int maxTimesToCraft )
|
||||
private int capCraftingAttempts( final int maxTimesToCraft )
|
||||
{
|
||||
return maxTimesToCraft;
|
||||
}
|
||||
|
||||
public ItemStack craftItem( final EntityPlayer p, final ItemStack request, final IMEMonitor<IAEItemStack> inv, final IItemList all )
|
||||
private ItemStack craftItem( final EntityPlayer p, final ItemStack request, final IMEMonitor<IAEItemStack> inv, final IItemList all )
|
||||
{
|
||||
// update crafting matrix...
|
||||
ItemStack is = this.getStack();
|
||||
|
||||
if( is != null && Platform.isSameItem( request, is ) )
|
||||
{
|
||||
final ItemStack[] set = new ItemStack[this.pattern.getSizeInventory()];
|
||||
final ItemStack[] set = new ItemStack[this.getPattern().getSizeInventory()];
|
||||
|
||||
// add one of each item to the items on the board...
|
||||
if( Platform.isServer() )
|
||||
@@ -167,7 +167,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
final InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
ic.setInventorySlotContents( x, this.pattern.getStackInSlot( x ) );
|
||||
ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) );
|
||||
}
|
||||
|
||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj );
|
||||
@@ -205,11 +205,11 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
|
||||
if( inv != null )
|
||||
{
|
||||
for( int x = 0; x < this.pattern.getSizeInventory(); x++ )
|
||||
for( int x = 0; x < this.getPattern().getSizeInventory(); x++ )
|
||||
{
|
||||
if( this.pattern.getStackInSlot( x ) != null )
|
||||
if( this.getPattern().getStackInSlot( x ) != null )
|
||||
{
|
||||
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.pattern.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
|
||||
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
|
||||
ic.setInventorySlotContents( x, set[x] );
|
||||
}
|
||||
}
|
||||
@@ -232,17 +232,17 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean preCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
|
||||
private boolean preCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void makeItem( final EntityPlayer p, final ItemStack is )
|
||||
private void makeItem( final EntityPlayer p, final ItemStack is )
|
||||
{
|
||||
super.onPickupFromSlot( p, is );
|
||||
}
|
||||
|
||||
public void postCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
|
||||
private void postCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
|
||||
{
|
||||
final List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
|
||||
@@ -273,4 +273,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
Platform.spawnDrops( p.worldObj, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops );
|
||||
}
|
||||
}
|
||||
|
||||
IInventory getPattern()
|
||||
{
|
||||
return this.pattern;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,9 @@ import net.minecraft.item.ItemStack;
|
||||
public class SlotFake extends AppEngSlot
|
||||
{
|
||||
|
||||
final int invSlot;
|
||||
|
||||
public SlotFake( final IInventory inv, final int idx, final int x, final int y )
|
||||
{
|
||||
super( inv, idx, x, y );
|
||||
this.invSlot = idx;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.item.ItemStack;
|
||||
public class SlotInaccessible extends AppEngSlot
|
||||
{
|
||||
|
||||
ItemStack dspStack = null;
|
||||
private ItemStack dspStack = null;
|
||||
|
||||
public SlotInaccessible( final IInventory i, final int slotIdx, final int x, final int y )
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ import appeng.container.implementations.ContainerMAC;
|
||||
public class SlotMACPattern extends AppEngSlot
|
||||
{
|
||||
|
||||
final ContainerMAC mac;
|
||||
private final ContainerMAC mac;
|
||||
|
||||
public SlotMACPattern( final ContainerMAC mac, final IInventory i, final int slotIdx, final int x, final int y )
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ public class SlotOutput extends AppEngSlot
|
||||
public SlotOutput( final IInventory a, final int b, final int c, final int d, final int i )
|
||||
{
|
||||
super( a, b, c, d );
|
||||
this.IIcon = i;
|
||||
this.setIIcon( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,8 +36,8 @@ import appeng.helpers.IContainerCraftingPacket;
|
||||
public class SlotPatternTerm extends SlotCraftingTerm
|
||||
{
|
||||
|
||||
final int groupNum;
|
||||
final IOptionalSlotHost host;
|
||||
private final int groupNum;
|
||||
private final IOptionalSlotHost host;
|
||||
|
||||
public SlotPatternTerm( final EntityPlayer player, final BaseActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IInventory cMatrix, final IInventory secondMatrix, final IInventory output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber, final IContainerCraftingPacket c )
|
||||
{
|
||||
@@ -49,7 +49,7 @@ public class SlotPatternTerm extends SlotCraftingTerm
|
||||
|
||||
public AppEngPacket getRequest( final boolean shift ) throws IOException
|
||||
{
|
||||
return new PacketPatternSlot( this.pattern, AEApi.instance().storage().createItemStack( this.getStack() ), shift );
|
||||
return new PacketPatternSlot( this.getPattern(), AEApi.instance().storage().createItemStack( this.getStack() ), shift );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,6 +28,6 @@ public class SlotPlayerHotBar extends AppEngSlot
|
||||
public SlotPlayerHotBar( final IInventory par1iInventory, final int par2, final int par3, final int par4 )
|
||||
{
|
||||
super( par1iInventory, par2, par3, par4 );
|
||||
this.isPlayerSide = true;
|
||||
this.setPlayerSide( true );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ public class SlotPlayerInv extends AppEngSlot
|
||||
{
|
||||
super( par1iInventory, par2, par3, par4 );
|
||||
|
||||
this.isPlayerSide = true;
|
||||
this.setPlayerSide( true );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,16 +53,16 @@ import appeng.util.Platform;
|
||||
public class SlotRestrictedInput extends AppEngSlot
|
||||
{
|
||||
|
||||
public final PlacableItemType which;
|
||||
private final PlacableItemType which;
|
||||
private final InventoryPlayer p;
|
||||
public boolean allowEdit = true;
|
||||
public int stackLimit = -1;
|
||||
private boolean allowEdit = true;
|
||||
private int stackLimit = -1;
|
||||
|
||||
public SlotRestrictedInput( final PlacableItemType valid, final IInventory i, final int slotIndex, final int x, final int y, final InventoryPlayer p )
|
||||
{
|
||||
super( i, slotIndex, x, y );
|
||||
this.which = valid;
|
||||
this.IIcon = valid.IIcon;
|
||||
this.setIIcon( valid.IIcon );
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
@Override
|
||||
public boolean isItemValid( final ItemStack i )
|
||||
{
|
||||
if( !this.myContainer.isValidForSlot( this, i ) )
|
||||
if( !this.getContainer().isValidForSlot( this, i ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !this.allowEdit )
|
||||
if( !this.isAllowEdit() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
@Override
|
||||
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
|
||||
{
|
||||
return this.allowEdit;
|
||||
return this.isAllowEdit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -275,6 +275,16 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isAllowEdit()
|
||||
{
|
||||
return this.allowEdit;
|
||||
}
|
||||
|
||||
public void setAllowEdit( final boolean allowEdit )
|
||||
{
|
||||
this.allowEdit = allowEdit;
|
||||
}
|
||||
|
||||
public enum PlacableItemType
|
||||
{
|
||||
STORAGE_CELLS( 15 ), ORE( 16 + 15 ), STORAGE_COMPONENT( 3 * 16 + 15 ),
|
||||
|
||||
Reference in New Issue
Block a user