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:
@@ -25,17 +25,17 @@ import net.minecraft.world.World;
|
||||
|
||||
public class BlockUpdate implements IWorldCallable<Boolean>
|
||||
{
|
||||
final BlockPos pos;
|
||||
private final BlockPos pos;
|
||||
|
||||
public BlockUpdate( final BlockPos pos )
|
||||
BlockUpdate( final BlockPos pos )
|
||||
{
|
||||
this.pos=pos;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean call( final World world ) throws Exception
|
||||
{
|
||||
if ( world.isBlockLoaded( this.pos ) )
|
||||
if( world.isBlockLoaded( this.pos ) )
|
||||
{
|
||||
world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +289,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() );
|
||||
|
||||
@@ -434,7 +434,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 )
|
||||
{
|
||||
@@ -1809,21 +1809,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...
|
||||
@@ -1834,12 +1834,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;
|
||||
|
||||
@@ -316,7 +316,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 )
|
||||
{
|
||||
@@ -331,11 +331,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()
|
||||
@@ -348,10 +348,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;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ import com.google.common.collect.ImmutableList;
|
||||
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 )
|
||||
{
|
||||
@@ -54,7 +54,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() );
|
||||
}
|
||||
@@ -65,7 +65,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;
|
||||
|
||||
@@ -114,7 +114,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 )
|
||||
@@ -185,4 +185,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 )
|
||||
|
||||
@@ -29,7 +29,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 )
|
||||
{
|
||||
|
||||
@@ -27,8 +27,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;
|
||||
@@ -49,9 +49,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import net.minecraft.util.IChatComponent;
|
||||
public class WrapperChainedInventory implements IInventory
|
||||
{
|
||||
|
||||
int fullSize = 0;
|
||||
private int fullSize = 0;
|
||||
private List<IInventory> l;
|
||||
private Map<Integer, InvOffset> offsets;
|
||||
|
||||
@@ -44,13 +44,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>();
|
||||
|
||||
@@ -78,7 +78,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();
|
||||
@@ -230,12 +230,12 @@ 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,7 +45,7 @@ public class WrapperInvSlot
|
||||
return true;
|
||||
}
|
||||
|
||||
class InternalInterfaceWrapper implements IInventory
|
||||
private class InternalInterfaceWrapper implements IInventory
|
||||
{
|
||||
|
||||
private final IInventory inv;
|
||||
|
||||
@@ -29,31 +29,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 )
|
||||
@@ -77,31 +77,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
|
||||
@@ -183,11 +183,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.minecraft.util.EnumFacing;
|
||||
public class WrapperMCISidedInventory extends WrapperInventoryRange implements IInventoryWrapper
|
||||
{
|
||||
|
||||
final ISidedInventory side;
|
||||
private final ISidedInventory side;
|
||||
private final EnumFacing dir;
|
||||
|
||||
public WrapperMCISidedInventory( final ISidedInventory a, final EnumFacing 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 );
|
||||
return this.side.canInsertItem( this.getSlots()[i], itemstack, this.dir );
|
||||
}
|
||||
|
||||
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 );
|
||||
return this.side.canExtractItem( this.getSlots()[i], is, this.dir );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,15 +47,15 @@ import appeng.util.Platform;
|
||||
public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFluidStack, Comparable<AEFluidStack>
|
||||
{
|
||||
|
||||
public int myHash;
|
||||
Fluid fluid;
|
||||
private int myHash;
|
||||
private Fluid fluid;
|
||||
private IAETagCompound tagCompound;
|
||||
|
||||
private AEFluidStack( final AEFluidStack is )
|
||||
{
|
||||
|
||||
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
|
||||
@@ -337,7 +337,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
public String toString()
|
||||
{
|
||||
return this.getFluidStack().toString();
|
||||
} @Override
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTagCompound()
|
||||
{
|
||||
return this.tagCompound != null;
|
||||
@@ -346,7 +348,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();
|
||||
@@ -361,8 +363,6 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
return this.fluid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
void writeIdentity( final ByteBuf i ) throws IOException
|
||||
{
|
||||
|
||||
@@ -35,21 +35,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 )
|
||||
{
|
||||
@@ -57,15 +58,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;
|
||||
}
|
||||
|
||||
@@ -81,24 +82,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;
|
||||
@@ -106,14 +107,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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,12 +49,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() );
|
||||
}
|
||||
@@ -72,9 +72,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." );
|
||||
}
|
||||
@@ -85,29 +85,28 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
|
||||
/*
|
||||
* Super hackery.
|
||||
*
|
||||
* is.itemID = appeng.api.Materials.matQuartz.itemID; damageValue = is.getItemDamage(); is.itemID = itemID;
|
||||
*/
|
||||
|
||||
/*
|
||||
* Kinda hackery
|
||||
*/
|
||||
this.def.damageValue = this.def.getDamageValueHack( is );
|
||||
this.def.displayDamage = ( int ) ( is.getItem().getDurabilityForDisplay( is ) * Integer.MAX_VALUE );
|
||||
this.def.maxDamage = is.getMaxDamage();
|
||||
this.getDefinition().setDamageValue( this.def.getDamageValueHack( is ) );
|
||||
this.getDefinition().setDisplayDamage( (int) ( is.getItem().getDurabilityForDisplay( is ) * Integer.MAX_VALUE ) );
|
||||
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 )
|
||||
@@ -125,7 +124,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;
|
||||
@@ -181,7 +180,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;
|
||||
@@ -218,7 +217,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
|
||||
@@ -228,7 +227,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
|
||||
@@ -245,11 +244,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
|
||||
{
|
||||
@@ -271,7 +270,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();
|
||||
@@ -286,16 +285,16 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
{
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = b.getItem();
|
||||
|
||||
|
||||
return ( ai.getDurabilityForDisplay( a ) < 0.001f ) == ( bi.getDurabilityForDisplay( b ) < 0.001f );
|
||||
}
|
||||
else
|
||||
{
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = b.getItem();
|
||||
|
||||
final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay(a);
|
||||
final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay(b);
|
||||
|
||||
final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay( a );
|
||||
final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay( b );
|
||||
|
||||
return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint );
|
||||
}
|
||||
@@ -332,7 +331,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();
|
||||
|
||||
@@ -354,8 +353,8 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = o.getItem();
|
||||
|
||||
final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay(a);
|
||||
final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay(o);
|
||||
final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay( a );
|
||||
final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay( o );
|
||||
|
||||
return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint );
|
||||
}
|
||||
@@ -404,7 +403,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
@Override
|
||||
public IAETagCompound getTagCompound()
|
||||
{
|
||||
return this.def.tagCompound;
|
||||
return this.getDefinition().getTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -428,10 +427,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;
|
||||
@@ -440,13 +439,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
|
||||
@@ -463,7 +462,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
|
||||
@@ -474,13 +473,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
|
||||
@@ -488,15 +487,16 @@ 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.def );// && 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 )
|
||||
{
|
||||
@@ -533,33 +533,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;
|
||||
}
|
||||
@@ -572,34 +572,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 )
|
||||
@@ -612,101 +612,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() );
|
||||
}
|
||||
|
||||
@@ -731,6 +731,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,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;
|
||||
|
||||
@@ -71,7 +71,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() )
|
||||
{
|
||||
@@ -98,18 +98,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 ) );
|
||||
@@ -124,7 +124,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 );
|
||||
|
||||
@@ -144,7 +144,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getHash()
|
||||
int getHash()
|
||||
{
|
||||
return this.hash;
|
||||
}
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -83,7 +83,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 )
|
||||
{
|
||||
|
||||
@@ -111,10 +111,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 );
|
||||
}
|
||||
@@ -143,9 +143,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;
|
||||
@@ -165,7 +165,7 @@ public class OreHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<ItemStack> getCachedOres( final String oreName )
|
||||
List<ItemStack> getCachedOres( final String oreName )
|
||||
{
|
||||
return this.oreDictCache.getUnchecked( oreName );
|
||||
}
|
||||
|
||||
@@ -37,12 +37,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 )
|
||||
{
|
||||
@@ -64,7 +64,7 @@ public class OreReference
|
||||
return this.aeOtherOptions;
|
||||
}
|
||||
|
||||
public Collection<Integer> getOres()
|
||||
Collection<Integer> getOres()
|
||||
{
|
||||
return this.ores;
|
||||
}
|
||||
|
||||
@@ -27,16 +27,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
|
||||
@@ -59,8 +59,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,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 )
|
||||
{
|
||||
@@ -46,7 +46,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 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user