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:
yueh
2015-10-08 15:42:42 +02:00
parent 1ea48fb389
commit 500fc47490
463 changed files with 5670 additions and 3757 deletions
+3 -3
View File
@@ -25,9 +25,9 @@ import net.minecraft.world.World;
public class BlockUpdate implements IWorldCallable<Boolean>
{
final int x;
final int y;
final int z;
private final int x;
private final int y;
private final int z;
public BlockUpdate( final int x, final int y, final int z )
{
@@ -30,8 +30,8 @@ import net.minecraft.item.ItemStack;
public class InWorldToolOperationResult
{
public final ItemStack BlockItem;
public final List<ItemStack> Drops;
private final ItemStack BlockItem;
private final List<ItemStack> Drops;
public InWorldToolOperationResult()
{
@@ -74,4 +74,14 @@ public class InWorldToolOperationResult
return new InWorldToolOperationResult( b, temp );
}
public ItemStack getBlockItem()
{
return this.BlockItem;
}
public List<ItemStack> getDrops()
{
return this.Drops;
}
}
+16 -5
View File
@@ -32,14 +32,15 @@ import appeng.util.item.AEItemStack;
public class ItemSorters
{
public static SortDir Direction = SortDir.ASCENDING;
private static SortDir Direction = SortDir.ASCENDING;
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_NAME = new Comparator<IAEItemStack>()
{
@Override
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
{
if( Direction == SortDir.ASCENDING )
if( getDirection() == SortDir.ASCENDING )
{
return Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) );
}
@@ -55,7 +56,7 @@ public class ItemSorters
final AEItemStack op1 = (AEItemStack) o1;
final AEItemStack op2 = (AEItemStack) o2;
if( Direction == SortDir.ASCENDING )
if( getDirection() == SortDir.ASCENDING )
{
return this.secondarySort( op2.getModID().compareToIgnoreCase( op1.getModID() ), o1, o2 );
}
@@ -78,7 +79,7 @@ public class ItemSorters
@Override
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
{
if( Direction == SortDir.ASCENDING )
if( getDirection() == SortDir.ASCENDING )
{
return compareLong( o2.getStackSize(), o1.getStackSize() );
}
@@ -99,7 +100,7 @@ public class ItemSorters
final int cmp = api.compareItems( o1.getItemStack(), o2.getItemStack() );
if( Direction == SortDir.ASCENDING )
if( getDirection() == SortDir.ASCENDING )
{
return cmp;
}
@@ -162,4 +163,14 @@ public class ItemSorters
}
return 1;
}
private static SortDir getDirection()
{
return Direction;
}
public static void setDirection( final SortDir direction )
{
Direction = direction;
}
}
+12 -2
View File
@@ -25,12 +25,22 @@ import net.minecraft.util.Vec3;
public class LookDirection
{
public final Vec3 a;
public final Vec3 b;
private final Vec3 a;
private final Vec3 b;
public LookDirection( final Vec3 a, final Vec3 b )
{
this.a = a;
this.b = b;
}
public Vec3 getA()
{
return this.a;
}
public Vec3 getB()
{
return this.b;
}
}
+9 -9
View File
@@ -272,7 +272,7 @@ public class Platform
/*
* Simple way to cycle an enum...
*/
public static <T extends Enum> T prevEnum( final T ce )
private static <T extends Enum> T prevEnum( final T ce )
{
final EnumSet valList = EnumSet.allOf( ce.getClass() );
@@ -417,7 +417,7 @@ public class Platform
* Lots of silliness to try and account for weird tag related junk, basically requires that two tags have at least
* something in their tags before it wasts its time comparing them.
*/
public static boolean sameStackStags( final ItemStack a, final ItemStack b )
private static boolean sameStackStags( final ItemStack a, final ItemStack b )
{
if( a == null && b == null )
{
@@ -1668,21 +1668,21 @@ public class Platform
public static boolean securityCheck( final GridNode a, final GridNode b )
{
if( a.lastSecurityKey == -1 && b.lastSecurityKey == -1 )
if( a.getLastSecurityKey() == -1 && b.getLastSecurityKey() == -1 )
{
return false;
}
else if( a.lastSecurityKey == b.lastSecurityKey )
else if( a.getLastSecurityKey() == b.getLastSecurityKey() )
{
return false;
}
final boolean a_isSecure = isPowered( a.getGrid() ) && a.lastSecurityKey != -1;
final boolean b_isSecure = isPowered( b.getGrid() ) && b.lastSecurityKey != -1;
final boolean a_isSecure = isPowered( a.getGrid() ) && a.getLastSecurityKey() != -1;
final boolean b_isSecure = isPowered( b.getGrid() ) && b.getLastSecurityKey() != -1;
if( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) )
{
AELog.info( "Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.lastSecurityKey + " vs " + b.lastSecurityKey + " & " + a.playerID + " vs " + b.playerID );
AELog.info( "Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.getLastSecurityKey() + " vs " + b.getLastSecurityKey() + " & " + a.getPlayerID() + " vs " + b.getPlayerID() );
}
// can't do that son...
@@ -1693,12 +1693,12 @@ public class Platform
if( !a_isSecure && b_isSecure )
{
return checkPlayerPermissions( b.getGrid(), a.playerID );
return checkPlayerPermissions( b.getGrid(), a.getPlayerID() );
}
if( a_isSecure && !b_isSecure )
{
return checkPlayerPermissions( a.getGrid(), b.playerID );
return checkPlayerPermissions( a.getGrid(), b.getPlayerID() );
}
return false;
@@ -317,7 +317,7 @@ public class AdaptorIInventory extends InventoryAdaptor
return left;
}
boolean canRemoveStackFromSlot( final int x, final ItemStack is )
private boolean canRemoveStackFromSlot( final int x, final ItemStack is )
{
if( this.wrapperEnabled )
{
@@ -332,11 +332,11 @@ public class AdaptorIInventory extends InventoryAdaptor
return new InvIterator();
}
class InvIterator implements Iterator<ItemSlot>
private class InvIterator implements Iterator<ItemSlot>
{
final ItemSlot is = new ItemSlot();
int x = 0;
private final ItemSlot is = new ItemSlot();
private int x = 0;
@Override
public boolean hasNext()
@@ -349,10 +349,10 @@ public class AdaptorIInventory extends InventoryAdaptor
{
final ItemStack iss = AdaptorIInventory.this.i.getStackInSlot( this.x );
this.is.isExtractable = AdaptorIInventory.this.canRemoveStackFromSlot( this.x, iss );
this.is.setExtractable( AdaptorIInventory.this.canRemoveStackFromSlot( this.x, iss ) );
this.is.setItemStack( iss );
this.is.slot = this.x;
this.is.setSlot( this.x );
this.x++;
return this.is;
}
+16 -6
View File
@@ -39,9 +39,9 @@ import appeng.util.item.AEItemStack;
public class IMEAdaptor extends InventoryAdaptor
{
final IMEInventory<IAEItemStack> target;
final BaseActionSource src;
int maxSlots = 0;
private final IMEInventory<IAEItemStack> target;
private final BaseActionSource src;
private int maxSlots = 0;
public IMEAdaptor( final IMEInventory<IAEItemStack> input, final BaseActionSource src )
{
@@ -55,7 +55,7 @@ public class IMEAdaptor extends InventoryAdaptor
return new IMEAdaptorIterator( this, this.getList() );
}
IItemList<IAEItemStack> getList()
private IItemList<IAEItemStack> getList()
{
return this.target.getAvailableItems( AEApi.instance().storage().createItemList() );
}
@@ -66,7 +66,7 @@ public class IMEAdaptor extends InventoryAdaptor
return this.doRemoveItems( amount, filter, destination, Actionable.MODULATE );
}
public ItemStack doRemoveItems( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type )
private ItemStack doRemoveItems( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type )
{
IAEItemStack req = null;
@@ -115,7 +115,7 @@ public class IMEAdaptor extends InventoryAdaptor
return this.doRemoveItemsFuzzy( amount, filter, destination, Actionable.MODULATE, fuzzyMode );
}
public ItemStack doRemoveItemsFuzzy( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type, final FuzzyMode fuzzyMode )
private ItemStack doRemoveItemsFuzzy( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type, final FuzzyMode fuzzyMode )
{
final IAEItemStack reqFilter = AEItemStack.create( filter );
if( reqFilter == null )
@@ -186,4 +186,14 @@ public class IMEAdaptor extends InventoryAdaptor
{
return !this.getList().isEmpty();
}
int getMaxSlots()
{
return this.maxSlots;
}
void setMaxSlots( final int maxSlots )
{
this.maxSlots = maxSlots;
}
}
@@ -38,7 +38,7 @@ public final class IMEAdaptorIterator implements Iterator<ItemSlot>
public IMEAdaptorIterator( final IMEAdaptor parent, final IItemList<IAEItemStack> availableItems )
{
this.stack = availableItems.iterator();
this.containerSize = parent.maxSlots;
this.containerSize = parent.getMaxSlots();
this.parent = parent;
}
@@ -52,13 +52,13 @@ public final class IMEAdaptorIterator implements Iterator<ItemSlot>
@Override
public ItemSlot next()
{
this.slot.slot = this.offset;
this.slot.setSlot( this.offset );
this.offset++;
this.slot.isExtractable = true;
this.slot.setExtractable( true );
if( this.parent.maxSlots < this.offset )
if( this.parent.getMaxSlots() < this.offset )
{
this.parent.maxSlots = this.offset;
this.parent.setMaxSlots( this.offset );
}
if( this.hasNext )
@@ -30,7 +30,7 @@ import appeng.util.item.AEItemStack;
public class IMEInventoryDestination implements IInventoryDestination
{
final IMEInventory<IAEItemStack> me;
private final IMEInventory<IAEItemStack> me;
public IMEInventoryDestination( final IMEInventory<IAEItemStack> o )
{
@@ -30,7 +30,7 @@ import appeng.api.storage.data.IItemList;
public class ItemListIgnoreCrafting<T extends IAEStack> implements IItemList<T>
{
final IItemList<T> target;
private final IItemList<T> target;
public ItemListIgnoreCrafting( final IItemList<T> cla )
{
+23 -3
View File
@@ -28,8 +28,8 @@ import appeng.util.item.AEItemStack;
public class ItemSlot
{
public int slot;
public boolean isExtractable;
private int slot;
private boolean isExtractable;
// one or the other..
private IAEItemStack aeItemStack;
private ItemStack itemStack;
@@ -50,9 +50,29 @@ public class ItemSlot
return this.aeItemStack == null ? ( this.itemStack == null ? null : ( this.aeItemStack = AEItemStack.create( this.itemStack ) ) ) : this.aeItemStack;
}
public void setAEItemStack( final IAEItemStack is )
void setAEItemStack( final IAEItemStack is )
{
this.aeItemStack = is;
this.itemStack = null;
}
public boolean isExtractable()
{
return this.isExtractable;
}
void setExtractable( final boolean isExtractable )
{
this.isExtractable = isExtractable;
}
public int getSlot()
{
return this.slot;
}
public void setSlot( final int slot )
{
this.slot = slot;
}
}
@@ -34,7 +34,7 @@ import net.minecraft.item.ItemStack;
public class WrapperChainedInventory implements IInventory
{
int fullSize = 0;
private int fullSize = 0;
private List<IInventory> l;
private Map<Integer, InvOffset> offsets;
@@ -43,13 +43,13 @@ public class WrapperChainedInventory implements IInventory
this.setInventory( inventories );
}
public void setInventory( final IInventory... a )
private void setInventory( final IInventory... a )
{
this.l = ImmutableList.copyOf( a );
this.calculateSizes();
}
public void calculateSizes()
private void calculateSizes()
{
this.offsets = new HashMap<Integer, WrapperChainedInventory.InvOffset>();
@@ -77,7 +77,7 @@ public class WrapperChainedInventory implements IInventory
this.setInventory( inventories );
}
public void setInventory( final List<IInventory> a )
private void setInventory( final List<IInventory> a )
{
this.l = a;
this.calculateSizes();
@@ -227,11 +227,11 @@ public class WrapperChainedInventory implements IInventory
return false;
}
static class InvOffset
private static class InvOffset
{
int offset;
int size;
IInventory i;
private int offset;
private int size;
private IInventory i;
}
}
@@ -44,7 +44,7 @@ public class WrapperInvSlot
return true;
}
class InternalInterfaceWrapper implements IInventory
private class InternalInterfaceWrapper implements IInventory
{
private final IInventory inv;
@@ -28,31 +28,31 @@ public class WrapperInventoryRange implements IInventory
{
private final IInventory src;
protected boolean ignoreValidItems = false;
int[] slots;
private boolean ignoreValidItems = false;
private int[] slots;
public WrapperInventoryRange( final IInventory a, final int[] s, final boolean ignoreValid )
{
this.src = a;
this.slots = s;
this.setSlots( s );
if( this.slots == null )
if( this.getSlots() == null )
{
this.slots = new int[0];
this.setSlots( new int[0] );
}
this.ignoreValidItems = ignoreValid;
this.setIgnoreValidItems( ignoreValid );
}
public WrapperInventoryRange( final IInventory a, final int min, final int size, final boolean ignoreValid )
{
this.src = a;
this.slots = new int[size];
this.setSlots( new int[size] );
for( int x = 0; x < size; x++ )
{
this.slots[x] = min + x;
this.getSlots()[x] = min + x;
}
this.ignoreValidItems = ignoreValid;
this.setIgnoreValidItems( ignoreValid );
}
public static String concatLines( final int[] s, final String separator )
@@ -76,31 +76,31 @@ public class WrapperInventoryRange implements IInventory
@Override
public int getSizeInventory()
{
return this.slots.length;
return this.getSlots().length;
}
@Override
public ItemStack getStackInSlot( final int var1 )
{
return this.src.getStackInSlot( this.slots[var1] );
return this.src.getStackInSlot( this.getSlots()[var1] );
}
@Override
public ItemStack decrStackSize( final int var1, final int var2 )
{
return this.src.decrStackSize( this.slots[var1], var2 );
return this.src.decrStackSize( this.getSlots()[var1], var2 );
}
@Override
public ItemStack getStackInSlotOnClosing( final int var1 )
{
return this.src.getStackInSlotOnClosing( this.slots[var1] );
return this.src.getStackInSlotOnClosing( this.getSlots()[var1] );
}
@Override
public void setInventorySlotContents( final int var1, final ItemStack var2 )
{
this.src.setInventorySlotContents( this.slots[var1], var2 );
this.src.setInventorySlotContents( this.getSlots()[var1], var2 );
}
@Override
@@ -148,11 +148,31 @@ public class WrapperInventoryRange implements IInventory
@Override
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
if( this.ignoreValidItems )
if( this.isIgnoreValidItems() )
{
return true;
}
return this.src.isItemValidForSlot( this.slots[i], itemstack );
return this.src.isItemValidForSlot( this.getSlots()[i], itemstack );
}
boolean isIgnoreValidItems()
{
return this.ignoreValidItems;
}
private void setIgnoreValidItems( final boolean ignoreValidItems )
{
this.ignoreValidItems = ignoreValidItems;
}
int[] getSlots()
{
return this.slots;
}
private void setSlots( final int[] slots )
{
this.slots = slots;
}
}
@@ -27,7 +27,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class WrapperMCISidedInventory extends WrapperInventoryRange implements IInventoryWrapper
{
final ISidedInventory side;
private final ISidedInventory side;
private final ForgeDirection dir;
public WrapperMCISidedInventory( final ISidedInventory a, final ForgeDirection d )
@@ -51,14 +51,14 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
if( this.ignoreValidItems )
if( this.isIgnoreValidItems() )
{
return true;
}
if( this.side.isItemValidForSlot( this.slots[i], itemstack ) )
if( this.side.isItemValidForSlot( this.getSlots()[i], itemstack ) )
{
return this.side.canInsertItem( this.slots[i], itemstack, this.dir.ordinal() );
return this.side.canInsertItem( this.getSlots()[i], itemstack, this.dir.ordinal() );
}
return false;
@@ -72,6 +72,6 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
return false;
}
return this.side.canExtractItem( this.slots[i], is, this.dir.ordinal() );
return this.side.canExtractItem( this.getSlots()[i], is, this.dir.ordinal() );
}
}
@@ -1,118 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.util.inv;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class WrapperTEPipe implements IInventory
{
final TileEntity ad;
final ForgeDirection dir;
public WrapperTEPipe( final TileEntity te, final ForgeDirection d )
{
this.ad = te;
this.dir = d;
}
@Override
public int getSizeInventory()
{
return 1;
}
@Override
public ItemStack getStackInSlot( final int i )
{
return null;
}
@Override
public ItemStack decrStackSize( final int i, final int j )
{
return null;
}
@Override
public ItemStack getStackInSlotOnClosing( final int i )
{
return null;
}
@Override
public void setInventorySlotContents( final int i, final ItemStack itemstack )
{
// ITE.addItemsToPipe( ad, itemstack, dir );
}
@Override
public String getInventoryName()
{
return null;
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
return 64;
}
@Override
public void markDirty()
{
}
@Override
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
{
return false;
}
@Override
public void openInventory()
{
}
@Override
public void closeInventory()
{
}
@Override
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return false;
}
}
@@ -55,7 +55,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
{
this.fluid = is.fluid;
this.stackSize = is.stackSize;
this.setStackSize( is.getStackSize() );
// priority = is.priority;
this.setCraftable( is.isCraftable() );
@@ -73,7 +73,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
throw new IllegalArgumentException( "Fluid is null." );
}
this.stackSize = is.amount;
this.setStackSize( is.amount );
this.setCraftable( false );
this.setCountRequestable( 0 );
@@ -89,7 +89,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
}
final AEFluidStack fluid = AEFluidStack.create( itemstack );
// fluid.priority = i.getInteger( "Priority" );
fluid.stackSize = i.getLong( "Cnt" );
fluid.setStackSize( i.getLong( "Cnt" ) );
fluid.setCountRequestable( i.getLong( "Req" ) );
fluid.setCraftable( i.getBoolean( "Craft" ) );
return fluid;
@@ -154,7 +154,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
final AEFluidStack fluid = AEFluidStack.create( fluidStack );
// fluid.priority = (int) priority;
fluid.stackSize = stackSize;
fluid.setStackSize( stackSize );
fluid.setCountRequestable( countRequestable );
fluid.setCraftable( isCraftable );
return fluid;
@@ -202,7 +202,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
/*
* if ( Cnt != null && Cnt instanceof NBTTagLong ) ((NBTTagLong) Cnt).data = this.stackSize; else
*/
i.setLong( "Cnt", this.stackSize );
i.setLong( "Cnt", this.getStackSize() );
/*
* if ( Req != null && Req instanceof NBTTagLong ) ((NBTTagLong) Req).data = this.stackSize; else
@@ -374,7 +374,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
@Override
public FluidStack getFluidStack()
{
final FluidStack is = new FluidStack( this.fluid, (int) Math.min( Integer.MAX_VALUE, this.stackSize ) );
final FluidStack is = new FluidStack( this.fluid, (int) Math.min( Integer.MAX_VALUE, this.getStackSize() ) );
if( this.tagCompound != null )
{
is.tag = this.tagCompound.getNBTTagCompoundCopy();
+132 -29
View File
@@ -37,21 +37,22 @@ public class AEItemDef
static final AESharedNBT LOW_TAG = new AESharedNBT( Integer.MIN_VALUE );
static final AESharedNBT HIGH_TAG = new AESharedNBT( Integer.MAX_VALUE );
public final int itemID;
public final Item item;
public int myHash;
public int def;
public int damageValue;
public int displayDamage;
public int maxDamage;
public AESharedNBT tagCompound;
private final int itemID;
private final Item item;
private int myHash;
private int def;
private int damageValue;
private int displayDamage;
private int maxDamage;
private AESharedNBT tagCompound;
@SideOnly( Side.CLIENT )
public String displayName;
private String displayName;
@SideOnly( Side.CLIENT )
public List tooltip;
private List tooltip;
@SideOnly( Side.CLIENT )
public UniqueIdentifier uniqueID;
public OreReference isOre;
private UniqueIdentifier uniqueID;
private OreReference isOre;
public AEItemDef( final Item it )
{
@@ -59,15 +60,15 @@ public class AEItemDef
this.itemID = Item.getIdFromItem( it );
}
public AEItemDef copy()
AEItemDef copy()
{
final AEItemDef t = new AEItemDef( this.item );
final AEItemDef t = new AEItemDef( this.getItem() );
t.def = this.def;
t.damageValue = this.damageValue;
t.displayDamage = this.displayDamage;
t.maxDamage = this.maxDamage;
t.tagCompound = this.tagCompound;
t.isOre = this.isOre;
t.setDamageValue( this.getDamageValue() );
t.setDisplayDamage( this.getDisplayDamage() );
t.setMaxDamage( this.getMaxDamage() );
t.setTagCompound( this.getTagCompound() );
t.setIsOre( this.getIsOre() );
return t;
}
@@ -83,24 +84,24 @@ public class AEItemDef
return false;
}
final AEItemDef other = (AEItemDef) obj;
return other.damageValue == this.damageValue && other.item == this.item && this.tagCompound == other.tagCompound;
return other.getDamageValue() == this.getDamageValue() && other.getItem() == this.getItem() && this.getTagCompound() == other.getTagCompound();
}
public boolean isItem( final ItemStack otherStack )
boolean isItem( final ItemStack otherStack )
{
// hackery!
final int dmg = this.getDamageValueHack( otherStack );
if( this.item == otherStack.getItem() && dmg == this.damageValue )
if( this.getItem() == otherStack.getItem() && dmg == this.getDamageValue() )
{
if( ( this.tagCompound != null ) == otherStack.hasTagCompound() )
if( ( this.getTagCompound() != null ) == otherStack.hasTagCompound() )
{
return true;
}
if( this.tagCompound != null && otherStack.hasTagCompound() )
if( this.getTagCompound() != null && otherStack.hasTagCompound() )
{
return Platform.NBTEqualityTest( this.tagCompound, otherStack.getTagCompound() );
return Platform.NBTEqualityTest( this.getTagCompound(), otherStack.getTagCompound() );
}
return true;
@@ -108,14 +109,116 @@ public class AEItemDef
return false;
}
public int getDamageValueHack( final ItemStack is )
int getDamageValueHack( final ItemStack is )
{
return Items.blaze_rod.getDamage( is );
}
public void reHash()
void reHash()
{
this.def = this.itemID << Platform.DEF_OFFSET | this.damageValue;
this.myHash = this.def ^ ( this.tagCompound == null ? 0 : System.identityHashCode( this.tagCompound ) );
this.def = this.getItemID() << Platform.DEF_OFFSET | this.getDamageValue();
this.myHash = this.def ^ ( this.getTagCompound() == null ? 0 : System.identityHashCode( this.getTagCompound() ) );
}
AESharedNBT getTagCompound()
{
return this.tagCompound;
}
void setTagCompound( final AESharedNBT tagCompound )
{
this.tagCompound = tagCompound;
}
int getDamageValue()
{
return this.damageValue;
}
int setDamageValue( final int damageValue )
{
this.damageValue = damageValue;
return damageValue;
}
Item getItem()
{
return this.item;
}
int getDisplayDamage()
{
return this.displayDamage;
}
void setDisplayDamage( final int displayDamage )
{
this.displayDamage = displayDamage;
}
String getDisplayName()
{
return this.displayName;
}
void setDisplayName( final String displayName )
{
this.displayName = displayName;
}
List getTooltip()
{
return this.tooltip;
}
List setTooltip( final List tooltip )
{
this.tooltip = tooltip;
return tooltip;
}
UniqueIdentifier getUniqueID()
{
return this.uniqueID;
}
UniqueIdentifier setUniqueID( final UniqueIdentifier uniqueID )
{
this.uniqueID = uniqueID;
return uniqueID;
}
OreReference getIsOre()
{
return this.isOre;
}
void setIsOre( final OreReference isOre )
{
this.isOre = isOre;
}
int getItemID()
{
return this.itemID;
}
int getMaxDamage()
{
return this.maxDamage;
}
void setMaxDamage( final int maxDamage )
{
this.maxDamage = maxDamage;
}
/**
* TODO: Check if replaceable by hashCode();
*/
int getMyHash()
{
return this.myHash;
}
}
+88 -76
View File
@@ -51,12 +51,12 @@ import appeng.util.Platform;
public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemStack, Comparable<AEItemStack>
{
AEItemDef def;
private AEItemDef def;
private AEItemStack( final AEItemStack is )
{
this.def = is.def;
this.stackSize = is.stackSize;
this.setDefinition( is.getDefinition() );
this.setStackSize( is.getStackSize() );
this.setCraftable( is.isCraftable() );
this.setCountRequestable( is.getCountRequestable() );
}
@@ -74,9 +74,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
throw new InvalidParameterException( "Contained item is null, thus not a valid ItemStack for AEItemStack." );
}
this.def = new AEItemDef( item );
this.setDefinition( new AEItemDef( item ) );
if( this.def.item == null )
if( this.getDefinition().getItem() == null )
{
throw new InvalidParameterException( "This ItemStack is bad, it has a null item." );
}
@@ -93,22 +93,22 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
/*
* Kinda hackery
*/
this.def.damageValue = this.def.getDamageValueHack( is );
this.def.displayDamage = is.getItemDamageForDisplay();
this.def.maxDamage = is.getMaxDamage();
this.getDefinition().setDamageValue( this.getDefinition().getDamageValueHack( is ) );
this.getDefinition().setDisplayDamage( is.getItemDamageForDisplay() );
this.getDefinition().setMaxDamage( is.getMaxDamage() );
final NBTTagCompound tagCompound = is.getTagCompound();
if( tagCompound != null )
{
this.def.tagCompound = (AESharedNBT) AESharedNBT.getSharedTagCompound( tagCompound, is );
this.getDefinition().setTagCompound( (AESharedNBT) AESharedNBT.getSharedTagCompound( tagCompound, is ) );
}
this.stackSize = is.stackSize;
this.setStackSize( is.stackSize );
this.setCraftable( false );
this.setCountRequestable( 0 );
this.def.reHash();
this.def.isOre = OreHelper.INSTANCE.isOre( is );
this.getDefinition().reHash();
this.getDefinition().setIsOre( OreHelper.INSTANCE.isOre( is ) );
}
public static IAEItemStack loadItemStackFromNBT( final NBTTagCompound i )
@@ -126,7 +126,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
final AEItemStack item = AEItemStack.create( itemstack );
// item.priority = i.getInteger( "Priority" );
item.stackSize = i.getLong( "Cnt" );
item.setStackSize( i.getLong( "Cnt" ) );
item.setCountRequestable( i.getLong( "Req" ) );
item.setCraftable( i.getBoolean( "Craft" ) );
return item;
@@ -182,7 +182,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
final AEItemStack item = AEItemStack.create( itemstack );
// item.priority = (int) priority;
item.stackSize = stackSize;
item.setStackSize( stackSize );
item.setCountRequestable( countRequestable );
item.setCraftable( isCraftable );
return item;
@@ -219,7 +219,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
/*
* if ( id != null && id instanceof NBTTagShort ) ((NBTTagShort) id).data = (short) this.def.item.itemID; else
*/
i.setShort( "id", (short) Item.itemRegistry.getIDForObject( this.def.item ) );
i.setShort( "id", (short) Item.itemRegistry.getIDForObject( this.getDefinition().getItem() ) );
/*
* if ( Count != null && Count instanceof NBTTagByte ) ((NBTTagByte) Count).data = (byte) 0; else
@@ -229,7 +229,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
/*
* if ( Cnt != null && Cnt instanceof NBTTagLong ) ((NBTTagLong) Cnt).data = this.stackSize; else
*/
i.setLong( "Cnt", this.stackSize );
i.setLong( "Cnt", this.getStackSize() );
/*
* if ( Req != null && Req instanceof NBTTagLong ) ((NBTTagLong) Req).data = this.stackSize; else
@@ -246,11 +246,11 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
* if ( Damage != null && Damage instanceof NBTTagShort ) ((NBTTagShort) Damage).data = (short)
* this.def.damageValue; else
*/
i.setShort( "Damage", (short) this.def.damageValue );
i.setShort( "Damage", (short) this.getDefinition().getDamageValue() );
if( this.def.tagCompound != null )
if( this.getDefinition().getTagCompound() != null )
{
i.setTag( "tag", this.def.tagCompound );
i.setTag( "tag", this.getDefinition().getTagCompound() );
}
else
{
@@ -272,7 +272,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
if( o.getItem() == this.getItem() )
{
if( this.def.item.isDamageable() )
if( this.getDefinition().getItem().isDamageable() )
{
final ItemStack a = this.getItemStack();
final ItemStack b = o.getItemStack();
@@ -327,7 +327,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
if( o.getItem() == this.getItem() )
{
if( this.def.item.isDamageable() )
if( this.getDefinition().getItem().isDamageable() )
{
final ItemStack a = this.getItemStack();
@@ -393,7 +393,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@Override
public IAETagCompound getTagCompound()
{
return this.def.tagCompound;
return this.getDefinition().getTagCompound();
}
@Override
@@ -417,10 +417,10 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@Override
public ItemStack getItemStack()
{
final ItemStack is = new ItemStack( this.def.item, (int) Math.min( Integer.MAX_VALUE, this.stackSize ), this.def.damageValue );
if( this.def.tagCompound != null )
final ItemStack is = new ItemStack( this.getDefinition().getItem(), (int) Math.min( Integer.MAX_VALUE, this.getStackSize() ), this.getDefinition().getDamageValue() );
if( this.getDefinition().getTagCompound() != null )
{
is.setTagCompound( this.def.tagCompound.getNBTTagCompoundCopy() );
is.setTagCompound( this.getDefinition().getTagCompound().getNBTTagCompoundCopy() );
}
return is;
@@ -429,13 +429,13 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@Override
public Item getItem()
{
return this.def.item;
return this.getDefinition().getItem();
}
@Override
public int getItemDamage()
{
return this.def.damageValue;
return this.getDefinition().getDamageValue();
}
@Override
@@ -452,7 +452,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return false;
}
return this.def.equals( ( (AEItemStack) otherStack ).def );
return this.getDefinition().equals( ( (AEItemStack) otherStack ).getDefinition() );
}
@Override
@@ -463,13 +463,13 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return false;
}
return this.def.isItem( otherStack );
return this.getDefinition().isItem( otherStack );
}
@Override
public int hashCode()
{
return this.def.myHash;
return this.getDefinition().getMyHash();
}
@Override
@@ -477,16 +477,17 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
{
if( ia instanceof AEItemStack )
{
return ( (AEItemStack) ia ).def.equals( this.def );// && def.tagCompound == ((AEItemStack)
// ia).def.tagCompound;
return ( (AEItemStack) ia ).getDefinition().equals( this.getDefinition() );// && def.tagCompound ==
// ((AEItemStack)
// ia).def.tagCompound;
}
else if( ia instanceof ItemStack )
{
final ItemStack is = (ItemStack) ia;
if( is.getItem() == this.def.item && is.getItemDamage() == this.def.damageValue )
if( is.getItem() == this.getDefinition().getItem() && is.getItemDamage() == this.getDefinition().getDamageValue() )
{
final NBTTagCompound ta = this.def.tagCompound;
final NBTTagCompound ta = this.getDefinition().getTagCompound();
final NBTTagCompound tb = is.getTagCompound();
if( ta == tb )
{
@@ -523,33 +524,33 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@Override
public int compareTo( final AEItemStack b )
{
final int id = this.def.itemID - b.def.itemID;
final int id = this.getDefinition().getItemID() - b.getDefinition().getItemID();
if( id != 0 )
{
return id;
}
final int damageValue = this.def.damageValue - b.def.damageValue;
final int damageValue = this.getDefinition().getDamageValue() - b.getDefinition().getDamageValue();
if( damageValue != 0 )
{
return damageValue;
}
final int displayDamage = this.def.displayDamage - b.def.displayDamage;
final int displayDamage = this.getDefinition().getDisplayDamage() - b.getDefinition().getDisplayDamage();
if( displayDamage != 0 )
{
return displayDamage;
}
return ( this.def.tagCompound == b.def.tagCompound ) ? 0 : this.compareNBT( b.def );
return ( this.getDefinition().getTagCompound() == b.getDefinition().getTagCompound() ) ? 0 : this.compareNBT( b.getDefinition() );
}
private int compareNBT( final AEItemDef b )
{
final int nbt = this.compare( ( this.def.tagCompound == null ? 0 : this.def.tagCompound.getHash() ), ( b.tagCompound == null ? 0 : b.tagCompound.getHash() ) );
final int nbt = this.compare( ( this.getDefinition().getTagCompound() == null ? 0 : this.getDefinition().getTagCompound().getHash() ), ( b.getTagCompound() == null ? 0 : b.getTagCompound().getHash() ) );
if( nbt == 0 )
{
return this.compare( System.identityHashCode( this.def.tagCompound ), System.identityHashCode( b.tagCompound ) );
return this.compare( System.identityHashCode( this.getDefinition().getTagCompound() ), System.identityHashCode( b.getTagCompound() ) );
}
return nbt;
}
@@ -562,34 +563,34 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@SideOnly( Side.CLIENT )
public List getToolTip()
{
if( this.def.tooltip != null )
if( this.getDefinition().getTooltip() != null )
{
return this.def.tooltip;
return this.getDefinition().getTooltip();
}
return this.def.tooltip = Platform.getTooltip( this.getItemStack() );
return this.getDefinition().setTooltip( Platform.getTooltip( this.getItemStack() ) );
}
@SideOnly( Side.CLIENT )
public String getDisplayName()
{
if( this.def.displayName != null )
if( this.getDefinition().getDisplayName() == null )
{
return this.def.displayName;
this.getDefinition().setDisplayName( Platform.getItemDisplayName( this.getItemStack() ) );
}
return this.def.displayName = Platform.getItemDisplayName( this.getItemStack() );
return this.getDefinition().getDisplayName();
}
@SideOnly( Side.CLIENT )
public String getModID()
{
if( this.def.uniqueID != null )
if( this.getDefinition().getUniqueID() != null )
{
return this.getModName( this.def.uniqueID );
return this.getModName( this.getDefinition().getUniqueID() );
}
return this.getModName( this.def.uniqueID = GameRegistry.findUniqueIdentifierFor( this.def.item ) );
return this.getModName( this.getDefinition().setUniqueID( GameRegistry.findUniqueIdentifierFor( this.getDefinition().getItem() ) ) );
}
private String getModName( final UniqueIdentifier uniqueIdentifier )
@@ -602,101 +603,101 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return uniqueIdentifier.modId == null ? "** Null" : uniqueIdentifier.modId;
}
public IAEItemStack getLow( final FuzzyMode fuzzy, final boolean ignoreMeta )
IAEItemStack getLow( final FuzzyMode fuzzy, final boolean ignoreMeta )
{
final AEItemStack bottom = new AEItemStack( this );
final AEItemDef newDef = bottom.def = bottom.def.copy();
final AEItemDef newDef = bottom.setDefinition( bottom.getDefinition().copy() );
if( ignoreMeta )
{
newDef.displayDamage = newDef.damageValue = 0;
newDef.setDisplayDamage( newDef.setDamageValue( 0 ) );
newDef.reHash();
return bottom;
}
if( newDef.item.isDamageable() )
if( newDef.getItem().isDamageable() )
{
if( fuzzy == FuzzyMode.IGNORE_ALL )
{
newDef.displayDamage = 0;
newDef.setDisplayDamage( 0 );
}
else if( fuzzy == FuzzyMode.PERCENT_99 )
{
if( this.def.damageValue == 0 )
if( this.getDefinition().getDamageValue() == 0 )
{
newDef.displayDamage = 0;
newDef.setDisplayDamage( 0 );
}
else
{
newDef.displayDamage = 1;
newDef.setDisplayDamage( 1 );
}
}
else
{
final int breakpoint = fuzzy.calculateBreakPoint( this.def.maxDamage );
newDef.displayDamage = breakpoint <= this.def.displayDamage ? breakpoint : 0;
final int breakpoint = fuzzy.calculateBreakPoint( this.getDefinition().getMaxDamage() );
newDef.setDisplayDamage( breakpoint <= this.getDefinition().getDisplayDamage() ? breakpoint : 0 );
}
newDef.damageValue = newDef.displayDamage;
newDef.setDamageValue( newDef.getDisplayDamage() );
}
newDef.tagCompound = AEItemDef.LOW_TAG;
newDef.setTagCompound( AEItemDef.LOW_TAG );
newDef.reHash();
return bottom;
}
public IAEItemStack getHigh( final FuzzyMode fuzzy, final boolean ignoreMeta )
IAEItemStack getHigh( final FuzzyMode fuzzy, final boolean ignoreMeta )
{
final AEItemStack top = new AEItemStack( this );
final AEItemDef newDef = top.def = top.def.copy();
final AEItemDef newDef = top.setDefinition( top.getDefinition().copy() );
if( ignoreMeta )
{
newDef.displayDamage = newDef.damageValue = Integer.MAX_VALUE;
newDef.setDisplayDamage( newDef.setDamageValue( Integer.MAX_VALUE ) );
newDef.reHash();
return top;
}
if( newDef.item.isDamageable() )
if( newDef.getItem().isDamageable() )
{
if( fuzzy == FuzzyMode.IGNORE_ALL )
{
newDef.displayDamage = this.def.maxDamage + 1;
newDef.setDisplayDamage( this.getDefinition().getMaxDamage() + 1 );
}
else if( fuzzy == FuzzyMode.PERCENT_99 )
{
if( this.def.damageValue == 0 )
if( this.getDefinition().getDamageValue() == 0 )
{
newDef.displayDamage = 0;
newDef.setDisplayDamage( 0 );
}
else
{
newDef.displayDamage = this.def.maxDamage + 1;
newDef.setDisplayDamage( this.getDefinition().getMaxDamage() + 1 );
}
}
else
{
final int breakpoint = fuzzy.calculateBreakPoint( this.def.maxDamage );
newDef.displayDamage = this.def.displayDamage < breakpoint ? breakpoint - 1 : this.def.maxDamage + 1;
final int breakpoint = fuzzy.calculateBreakPoint( this.getDefinition().getMaxDamage() );
newDef.setDisplayDamage( this.getDefinition().getDisplayDamage() < breakpoint ? breakpoint - 1 : this.getDefinition().getMaxDamage() + 1 );
}
newDef.damageValue = newDef.displayDamage;
newDef.setDamageValue( newDef.getDisplayDamage() );
}
newDef.tagCompound = AEItemDef.HIGH_TAG;
newDef.setTagCompound( AEItemDef.HIGH_TAG );
newDef.reHash();
return top;
}
public boolean isOre()
{
return this.def.isOre != null;
return this.getDefinition().getIsOre() != null;
}
@Override
void writeIdentity( final ByteBuf i ) throws IOException
{
i.writeShort( Item.itemRegistry.getIDForObject( this.def.item ) );
i.writeShort( Item.itemRegistry.getIDForObject( this.getDefinition().getItem() ) );
i.writeShort( this.getItemDamage() );
}
@@ -721,6 +722,17 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@Override
public boolean hasTagCompound()
{
return this.def.tagCompound != null;
return this.getDefinition().getTagCompound() != null;
}
AEItemDef getDefinition()
{
return this.def;
}
private AEItemDef setDefinition( final AEItemDef def )
{
this.def = def;
return def;
}
}
@@ -44,7 +44,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
private static final WeakHashMap<SharedSearchObject, WeakReference<SharedSearchObject>> SHARED_TAG_COMPOUND = new WeakHashMap<SharedSearchObject, WeakReference<SharedSearchObject>>();
private final Item item;
private final int meta;
public SharedSearchObject sso;
private SharedSearchObject sso;
private int hash;
private IItemComparison comp;
@@ -72,7 +72,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
/*
* Returns an NBT Compound that is used for accelerating comparisons.
*/
public static synchronized NBTTagCompound getSharedTagCompound( final NBTTagCompound tagCompound, final ItemStack s )
static synchronized NBTTagCompound getSharedTagCompound( final NBTTagCompound tagCompound, final ItemStack s )
{
if( tagCompound.hasNoTags() )
{
@@ -99,18 +99,18 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
final SharedSearchObject cg = c.get();
if( cg != null )
{
return cg.shared; // I don't think I really need to check this
return cg.getShared(); // I don't think I really need to check this
}
// as its already certain to exist..
}
final AESharedNBT clone = AESharedNBT.createFromCompound( item, meta, tagCompound );
sso.compound = (NBTTagCompound) sso.compound.copy(); // prevent
sso.setCompound( (NBTTagCompound) sso.getCompound().copy() ); // prevent
// modification
// of data based
// on original
// item.
sso.shared = clone;
sso.setShared( clone );
clone.sso = sso;
SHARED_TAG_COMPOUND.put( sso, new WeakReference<SharedSearchObject>( sso ) );
@@ -125,7 +125,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
return ta instanceof AESharedNBT;
}
public static AESharedNBT createFromCompound( final Item itemID, final int damageValue, final NBTTagCompound c )
private static AESharedNBT createFromCompound( final Item itemID, final int damageValue, final NBTTagCompound c )
{
final AESharedNBT x = new AESharedNBT( itemID, damageValue );
@@ -145,7 +145,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
return x;
}
public int getHash()
int getHash()
{
return this.hash;
}
+5 -5
View File
@@ -29,9 +29,9 @@ import appeng.api.storage.data.IAEStack;
public abstract class AEStack<StackType extends IAEStack> implements IAEStack<StackType>
{
protected boolean isCraftable;
protected long stackSize;
protected long countRequestable;
private boolean isCraftable;
private long stackSize;
private long countRequestable;
static long getPacketValue( final byte type, final ByteBuf tag )
{
@@ -151,7 +151,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
this.putPacketValue( i, this.countRequestable );
}
byte getType( final long num )
private byte getType( final long num )
{
if( num <= 255 )
{
@@ -177,7 +177,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
abstract void readNBT( ByteBuf i ) throws IOException;
void putPacketValue( final ByteBuf tag, final long num )
private void putPacketValue( final ByteBuf tag, final long num )
{
if( num <= 255 )
{
+1 -1
View File
@@ -85,7 +85,7 @@ public final class ItemList implements IItemList<IAEItemStack>
if( ais.isOre() )
{
final OreReference or = ais.def.isOre;
final OreReference or = ais.getDefinition().getIsOre();
if( or.getAEEquivalents().size() == 1 )
{
@@ -30,8 +30,8 @@ import appeng.api.storage.data.IItemContainer;
public class ItemModList implements IItemContainer<IAEItemStack>
{
final IItemContainer<IAEItemStack> backingStore;
final IItemContainer<IAEItemStack> overrides = AEApi.instance().storage().createItemList();
private final IItemContainer<IAEItemStack> backingStore;
private final IItemContainer<IAEItemStack> overrides = AEApi.instance().storage().createItemList();
public ItemModList( final IItemContainer<IAEItemStack> backend )
{
@@ -112,10 +112,10 @@ public class OreHelper
return this.references.get( ir );
}
public boolean sameOre( final AEItemStack aeItemStack, final IAEItemStack is )
boolean sameOre( final AEItemStack aeItemStack, final IAEItemStack is )
{
final OreReference a = aeItemStack.def.isOre;
final OreReference b = aeItemStack.def.isOre;
final OreReference a = aeItemStack.getDefinition().getIsOre();
final OreReference b = aeItemStack.getDefinition().getIsOre();
return this.sameOre( a, b );
}
@@ -144,9 +144,9 @@ public class OreHelper
return false;
}
public boolean sameOre( final AEItemStack aeItemStack, final ItemStack o )
boolean sameOre( final AEItemStack aeItemStack, final ItemStack o )
{
final OreReference a = aeItemStack.def.isOre;
final OreReference a = aeItemStack.getDefinition().getIsOre();
if( a == null )
{
return false;
@@ -166,7 +166,7 @@ public class OreHelper
return false;
}
public List<ItemStack> getCachedOres( final String oreName )
List<ItemStack> getCachedOres( final String oreName )
{
return this.oreDictCache.getUnchecked( oreName );
}
@@ -38,12 +38,12 @@ public class OreReference
private final Set<Integer> ores = new HashSet<Integer>();
private List<IAEItemStack> aeOtherOptions = null;
public Collection<String> getEquivalents()
Collection<String> getEquivalents()
{
return this.otherOptions;
}
public List<IAEItemStack> getAEEquivalents()
List<IAEItemStack> getAEEquivalents()
{
if( this.aeOtherOptions == null )
{
@@ -65,7 +65,7 @@ public class OreReference
return this.aeOtherOptions;
}
public Collection<Integer> getOres()
Collection<Integer> getOres()
{
return this.ores;
}
@@ -28,16 +28,16 @@ import appeng.util.Platform;
public class SharedSearchObject
{
final int def;
final int hash;
public AESharedNBT shared;
NBTTagCompound compound;
private final int def;
private final int hash;
private AESharedNBT shared;
private NBTTagCompound compound;
public SharedSearchObject( final Item itemID, final int damageValue, final NBTTagCompound tagCompound )
{
this.def = ( damageValue << Platform.DEF_OFFSET ) | Item.itemRegistry.getIDForObject( itemID );
this.hash = Platform.NBTOrderlessHash( tagCompound );
this.compound = tagCompound;
this.setCompound( tagCompound );
}
@Override
@@ -60,8 +60,28 @@ public class SharedSearchObject
final SharedSearchObject other = (SharedSearchObject) obj;
if( this.def == other.def && this.hash == other.hash )
{
return Platform.NBTEqualityTest( this.compound, other.compound );
return Platform.NBTEqualityTest( this.getCompound(), other.getCompound() );
}
return false;
}
AESharedNBT getShared()
{
return this.shared;
}
void setShared( final AESharedNBT shared )
{
this.shared = shared;
}
NBTTagCompound getCompound()
{
return this.compound;
}
void setCompound( final NBTTagCompound compound )
{
this.compound = compound;
}
}
@@ -51,7 +51,7 @@ public final class UnsortedItemList implements IItemList<IAEItemStack>
{
@Override
public boolean apply( @Nonnull IAEItemStack input )
public boolean apply( @Nonnull final IAEItemStack input )
{
return input.isMeaningful();
}
@@ -60,7 +60,7 @@ public final class UnsortedItemList implements IItemList<IAEItemStack>
private final Map<IAEItemStack, IAEItemStack> records = new HashMap<IAEItemStack, IAEItemStack>();
@Override
public void add( IAEItemStack option )
public void add( final IAEItemStack option )
{
if( option == null )
{
@@ -81,7 +81,7 @@ public final class UnsortedItemList implements IItemList<IAEItemStack>
}
@Override
public IAEItemStack findPrecise( IAEItemStack itemStack )
public IAEItemStack findPrecise( final IAEItemStack itemStack )
{
if( itemStack == null )
{
@@ -136,7 +136,7 @@ public final class UnsortedItemList implements IItemList<IAEItemStack>
*/
@Override
@Deprecated
public Collection<IAEItemStack> findFuzzy( IAEItemStack filter, FuzzyMode fuzzy )
public Collection<IAEItemStack> findFuzzy( final IAEItemStack filter, final FuzzyMode fuzzy )
{
throw new UnsupportedOperationException( "Unsupported on an unsorted collection" );
}
@@ -148,7 +148,7 @@ public final class UnsortedItemList implements IItemList<IAEItemStack>
*/
@Override
@Deprecated
public void addStorage( IAEItemStack option )
public void addStorage( final IAEItemStack option )
{
throw new UnsupportedOperationException( "Purely designed for item storage" );
}
@@ -160,7 +160,7 @@ public final class UnsortedItemList implements IItemList<IAEItemStack>
*/
@Override
@Deprecated
public void addCrafting( IAEItemStack option )
public void addCrafting( final IAEItemStack option )
{
throw new UnsupportedOperationException( "Purely designed for item storage" );
}
@@ -172,7 +172,7 @@ public final class UnsortedItemList implements IItemList<IAEItemStack>
*/
@Override
@Deprecated
public void addRequestable( IAEItemStack option )
public void addRequestable( final IAEItemStack option )
{
throw new UnsupportedOperationException( "Purely designed for item storage" );
}
@@ -29,9 +29,9 @@ import appeng.util.inv.ItemSlot;
public class StackToSlotIterator implements Iterator<ItemSlot>
{
final ItemSlot iss = new ItemSlot();
final Iterator<ItemStack> is;
int x = 0;
private final ItemSlot iss = new ItemSlot();
private final Iterator<ItemStack> is;
private int x = 0;
public StackToSlotIterator( final Iterator<ItemStack> is )
{
@@ -47,7 +47,7 @@ public class StackToSlotIterator implements Iterator<ItemSlot>
@Override
public ItemSlot next()
{
this.iss.slot = this.x;
this.iss.setSlot( this.x );
this.x++;
this.iss.setItemStack( this.is.next() );
return this.iss;
@@ -28,7 +28,7 @@ import appeng.api.storage.data.IAEStack;
public class DefaultPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
{
static final List NULL_LIST = new ArrayList();
private static final List NULL_LIST = new ArrayList();
@Override
public boolean isListed( final T input )
@@ -29,8 +29,8 @@ import appeng.api.storage.data.IItemList;
public class FuzzyPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
{
final IItemList<T> list;
final FuzzyMode mode;
private final IItemList<T> list;
private final FuzzyMode mode;
public FuzzyPriorityList( final IItemList<T> in, final FuzzyMode mode )
{
@@ -26,7 +26,7 @@ import appeng.api.storage.data.IItemList;
public class PrecisePriorityList<T extends IAEStack<T>> implements IPartitionList<T>
{
final IItemList<T> list;
private final IItemList<T> list;
public PrecisePriorityList( final IItemList<T> in )
{