Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 720b38442e | |||
| 136f5d7314 | |||
| a83e4b7c3d | |||
| 1bb0109c45 | |||
| 4744dfab78 | |||
| 7dedd4700f | |||
| 95fb894ba3 | |||
| 621ddc5535 | |||
| ece09a956b | |||
| db5493f60b | |||
| f0482dd391 | |||
| c53b3b5dfc | |||
| ad16550a86 | |||
| 99e4928542 | |||
| 43995a4b32 | |||
| 53f448e578 |
@@ -128,7 +128,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
||||
// AE
|
||||
"CertusQuartz", "Wheat", "Fluix",
|
||||
// Other Mod Ores
|
||||
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium" };
|
||||
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium", "Zinc" };
|
||||
|
||||
public double oreDoublePercentage = 90.0;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -37,20 +38,20 @@ import appeng.recipes.ores.IOreListener;
|
||||
import appeng.recipes.ores.OreDictionaryHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||
|
||||
public final class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||
{
|
||||
private final List<IGrinderEntry> recipes;
|
||||
private final Map<ItemStack, String> ores;
|
||||
private final Map<ItemStack, String> ingots;
|
||||
private final Map<String, ItemStack> dusts;
|
||||
|
||||
public final List<IGrinderEntry> RecipeList;
|
||||
|
||||
private ItemStack copy(ItemStack is)
|
||||
public GrinderRecipeManager()
|
||||
{
|
||||
if ( is != null )
|
||||
return is.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
public GrinderRecipeManager() {
|
||||
this.RecipeList = new ArrayList<IGrinderEntry>();
|
||||
this.recipes = new ArrayList<IGrinderEntry>();
|
||||
this.ores = new HashMap<ItemStack, String>();
|
||||
this.ingots = new HashMap<ItemStack, String>();
|
||||
this.dusts = new HashMap<String, ItemStack>();
|
||||
|
||||
this.addOre( "Coal", new ItemStack( Items.coal ) );
|
||||
this.addOre( "Charcoal", new ItemStack( Items.coal, 1, 1 ) );
|
||||
@@ -78,20 +79,11 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||
public List<IGrinderEntry> getRecipes()
|
||||
{
|
||||
this.log( "API - getRecipes" );
|
||||
return this.RecipeList;
|
||||
}
|
||||
|
||||
private void injectRecipe(AppEngGrinderRecipe appEngGrinderRecipe)
|
||||
{
|
||||
for (IGrinderEntry gr : this.RecipeList)
|
||||
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
|
||||
return;
|
||||
|
||||
this.RecipeList.add( appEngGrinderRecipe );
|
||||
return this.recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe(ItemStack in, ItemStack out, int cost)
|
||||
public void addRecipe( ItemStack in, ItemStack out, int cost )
|
||||
{
|
||||
if ( in == null || out == null )
|
||||
{
|
||||
@@ -104,40 +96,54 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, int cost)
|
||||
public void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, int cost )
|
||||
{
|
||||
if ( in == null || (optional == null && out == null) )
|
||||
if ( in == null || ( optional == null && out == null ) )
|
||||
{
|
||||
this.log( "Invalid Grinder Recipe Specified." );
|
||||
return;
|
||||
}
|
||||
|
||||
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
|
||||
+ Platform.getItemDisplayName( optional ) + " for " + cost );
|
||||
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
|
||||
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int cost)
|
||||
public void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int cost )
|
||||
{
|
||||
if ( in == null || (optional == null && out == null && optional2 == null) )
|
||||
if ( in == null || ( optional == null && out == null && optional2 == null ) )
|
||||
{
|
||||
this.log( "Invalid Grinder Recipe Specified." );
|
||||
return;
|
||||
}
|
||||
|
||||
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
|
||||
+ Platform.getItemDisplayName( optional ) + " for " + cost );
|
||||
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
|
||||
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
|
||||
}
|
||||
|
||||
private void injectRecipe( AppEngGrinderRecipe appEngGrinderRecipe )
|
||||
{
|
||||
for ( IGrinderEntry gr : this.recipes )
|
||||
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
|
||||
return;
|
||||
|
||||
this.recipes.add( appEngGrinderRecipe );
|
||||
}
|
||||
|
||||
private ItemStack copy( ItemStack is )
|
||||
{
|
||||
if ( is != null )
|
||||
return is.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrinderEntry getRecipeForInput(ItemStack input)
|
||||
public IGrinderEntry getRecipeForInput( ItemStack input )
|
||||
{
|
||||
this.log( "Looking up recipe for " + Platform.getItemDisplayName( input ) );
|
||||
if ( input != null )
|
||||
{
|
||||
for (IGrinderEntry r : this.RecipeList)
|
||||
for ( IGrinderEntry r : this.recipes )
|
||||
{
|
||||
if ( Platform.isSameItem( input, r.getInput() ) )
|
||||
{
|
||||
@@ -152,12 +158,12 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||
return null;
|
||||
}
|
||||
|
||||
public void log(String o)
|
||||
public void log( String o )
|
||||
{
|
||||
AELog.grinder( o );
|
||||
}
|
||||
|
||||
private int getDustToOreRatio(String name)
|
||||
private int getDustToOreRatio( String name )
|
||||
{
|
||||
if ( name.equals( "Obsidian" ) )
|
||||
return 1;
|
||||
@@ -168,52 +174,48 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||
return 2;
|
||||
}
|
||||
|
||||
public final Map<ItemStack, String> Ores = new HashMap<ItemStack, String>();
|
||||
public final Map<ItemStack, String> Ingots = new HashMap<ItemStack, String>();
|
||||
public final Map<String, ItemStack> Dusts = new HashMap<String, ItemStack>();
|
||||
|
||||
private void addOre(String name, ItemStack item)
|
||||
private void addOre( String name, ItemStack item )
|
||||
{
|
||||
if ( item == null )
|
||||
return;
|
||||
this.log( "Adding Ore - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||
|
||||
this.Ores.put( item, name );
|
||||
this.ores.put( item, name );
|
||||
|
||||
if ( this.Dusts.containsKey( name ) )
|
||||
if ( this.dusts.containsKey( name ) )
|
||||
{
|
||||
ItemStack is = this.Dusts.get( name ).copy();
|
||||
ItemStack is = this.dusts.get( name ).copy();
|
||||
int ratio = this.getDustToOreRatio( name );
|
||||
if ( ratio > 1 )
|
||||
{
|
||||
ItemStack extra = is.copy();
|
||||
extra.stackSize = ratio - 1;
|
||||
this.addRecipe( item, is, extra, (float) (AEConfig.instance.oreDoublePercentage / 100.0), 8 );
|
||||
this.addRecipe( item, is, extra, (float) ( AEConfig.instance.oreDoublePercentage / 100.0 ), 8 );
|
||||
}
|
||||
else
|
||||
this.addRecipe( item, is, 8 );
|
||||
}
|
||||
}
|
||||
|
||||
private void addIngot(String name, ItemStack item)
|
||||
private void addIngot( String name, ItemStack item )
|
||||
{
|
||||
if ( item == null )
|
||||
return;
|
||||
this.log( "Adding Ingot - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||
|
||||
this.Ingots.put( item, name );
|
||||
this.ingots.put( item, name );
|
||||
|
||||
if ( this.Dusts.containsKey( name ) )
|
||||
if ( this.dusts.containsKey( name ) )
|
||||
{
|
||||
this.addRecipe( item, this.Dusts.get( name ), 4 );
|
||||
this.addRecipe( item, this.dusts.get( name ), 4 );
|
||||
}
|
||||
}
|
||||
|
||||
private void addDust(String name, ItemStack item)
|
||||
private void addDust( String name, ItemStack item )
|
||||
{
|
||||
if ( item == null )
|
||||
return;
|
||||
if ( this.Dusts.containsKey( name ) )
|
||||
if ( this.dusts.containsKey( name ) )
|
||||
{
|
||||
this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||
return;
|
||||
@@ -221,9 +223,9 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||
|
||||
this.log( "Adding Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||
|
||||
this.Dusts.put( name, item );
|
||||
this.dusts.put( name, item );
|
||||
|
||||
for (Entry<ItemStack, String> d : this.Ores.entrySet())
|
||||
for ( Entry<ItemStack, String> d : this.ores.entrySet() )
|
||||
if ( name.equals( d.getValue() ) )
|
||||
{
|
||||
ItemStack is = item.copy();
|
||||
@@ -233,23 +235,23 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||
{
|
||||
ItemStack extra = is.copy();
|
||||
extra.stackSize = ratio - 1;
|
||||
this.addRecipe( d.getKey(), is, extra, (float) (AEConfig.instance.oreDoublePercentage / 100.0), 8 );
|
||||
this.addRecipe( d.getKey(), is, extra, (float) ( AEConfig.instance.oreDoublePercentage / 100.0 ), 8 );
|
||||
}
|
||||
else
|
||||
this.addRecipe( d.getKey(), is, 8 );
|
||||
}
|
||||
|
||||
for (Entry<ItemStack, String> d : this.Ingots.entrySet())
|
||||
for ( Entry<ItemStack, String> d : this.ingots.entrySet() )
|
||||
if ( name.equals( d.getValue() ) )
|
||||
this.addRecipe( d.getKey(), item, 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void oreRegistered(String name, ItemStack item)
|
||||
public void oreRegistered( String name, ItemStack item )
|
||||
{
|
||||
if ( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name.startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) )
|
||||
{
|
||||
for (String ore : AEConfig.instance.grinderOres)
|
||||
for ( String ore : AEConfig.instance.grinderOres )
|
||||
{
|
||||
if ( name.equals( "ore" + ore ) )
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -56,13 +57,14 @@ import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
|
||||
|
||||
public class PacketNEIRecipe extends AppEngPacket
|
||||
{
|
||||
|
||||
ItemStack[][] recipe;
|
||||
|
||||
// automatic.
|
||||
public PacketNEIRecipe(ByteBuf stream) throws IOException
|
||||
public PacketNEIRecipe( ByteBuf stream ) throws IOException
|
||||
{
|
||||
ByteArrayInputStream bytes = new ByteArrayInputStream( stream.array() );
|
||||
bytes.skip( stream.readerIndex() );
|
||||
@@ -70,13 +72,13 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
if ( comp != null )
|
||||
{
|
||||
this.recipe = new ItemStack[9][];
|
||||
for (int x = 0; x < this.recipe.length; x++)
|
||||
for ( int x = 0; x < this.recipe.length; x++ )
|
||||
{
|
||||
NBTTagList list = comp.getTagList( "#" + x, 10 );
|
||||
if ( list.tagCount() > 0 )
|
||||
{
|
||||
this.recipe[x] = new ItemStack[list.tagCount()];
|
||||
for (int y = 0; y < list.tagCount(); y++)
|
||||
for ( int y = 0; y < list.tagCount(); y++ )
|
||||
{
|
||||
this.recipe[x][y] = ItemStack.loadItemStackFromNBT( list.getCompoundTagAt( y ) );
|
||||
}
|
||||
@@ -86,14 +88,14 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
|
||||
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
|
||||
{
|
||||
EntityPlayerMP pmp = (EntityPlayerMP) player;
|
||||
EntityPlayerMP pmp = ( EntityPlayerMP ) player;
|
||||
Container con = pmp.openContainer;
|
||||
|
||||
if ( con != null && con instanceof IContainerCraftingPacket )
|
||||
{
|
||||
IContainerCraftingPacket cct = (IContainerCraftingPacket) con;
|
||||
IContainerCraftingPacket cct = ( IContainerCraftingPacket ) con;
|
||||
IGridNode node = cct.getNetworkNode();
|
||||
if ( node != null )
|
||||
{
|
||||
@@ -112,11 +114,11 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
if ( inv != null && this.recipe != null && security != null )
|
||||
{
|
||||
InventoryCrafting testInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
for (int x = 0; x < 9; x++)
|
||||
for ( int x = 0; x < 9; x++ )
|
||||
{
|
||||
if ( this.recipe[x] != null && this.recipe[x].length > 0 )
|
||||
{
|
||||
testInv.setInventorySlotContents(x, this.recipe[x][0]);
|
||||
testInv.setInventorySlotContents( x, this.recipe[x][0] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,16 +134,16 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
IItemList all = storage.getStorageList();
|
||||
IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
|
||||
|
||||
for (int x = 0; x < craftMatrix.getSizeInventory(); x++)
|
||||
for ( int x = 0; x < craftMatrix.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack PatternItem = testInv.getStackInSlot( x );
|
||||
|
||||
ItemStack currentItem = craftMatrix.getStackInSlot( x );
|
||||
if ( currentItem != null )
|
||||
{
|
||||
testInv.setInventorySlotContents(x, currentItem);
|
||||
testInv.setInventorySlotContents( x, currentItem );
|
||||
ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
|
||||
testInv.setInventorySlotContents(x, PatternItem);
|
||||
testInv.setInventorySlotContents( x, PatternItem );
|
||||
|
||||
if ( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
|
||||
{
|
||||
@@ -171,7 +173,7 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
// TODO see if this code is necessary
|
||||
if ( whichItem == null )
|
||||
{
|
||||
for (int y = 0; y < this.recipe[x].length; y++)
|
||||
for ( int y = 0; y < this.recipe[x].length; y++ )
|
||||
{
|
||||
IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
|
||||
if ( request != null )
|
||||
@@ -191,21 +193,28 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
}
|
||||
|
||||
// If that doesn't work, grab from the player's inventory
|
||||
if ( whichItem == null && playerInventory != null ) {
|
||||
for ( int y = 0; y < playerInventory.getSizeInventory(); y++ )
|
||||
if ( whichItem == null && playerInventory != null )
|
||||
{
|
||||
for ( int y = 0; y < this.recipe[x].length; y++ )
|
||||
{
|
||||
// Put the item in the test inventory, and check if the recipe is satisfied
|
||||
testInv.setInventorySlotContents(x, playerInventory.getStackInSlot(y));
|
||||
if ( r.matches(testInv, pmp.worldObj) )
|
||||
ItemStack playerItemStack = null;
|
||||
for ( int i = 0; i < playerInventory.getSizeInventory(); i++ )
|
||||
{
|
||||
// Take the item out.
|
||||
if ( realForFake == Actionable.SIMULATE ) {
|
||||
whichItem = playerInventory.getStackInSlot(y).copy();
|
||||
whichItem.stackSize = 1;
|
||||
} else {
|
||||
whichItem = playerInventory.decrStackSize(y, 1);
|
||||
// check if the item in slot y matches the required item.
|
||||
playerItemStack = playerInventory.getStackInSlot( i );
|
||||
if ( playerItemStack != null && playerItemStack.getItem() == this.recipe[x][y].getItem() )
|
||||
{
|
||||
if ( realForFake == Actionable.SIMULATE )
|
||||
{
|
||||
whichItem = playerInventory.getStackInSlot( i ).copy();
|
||||
whichItem.stackSize = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
whichItem = playerInventory.decrStackSize( i, 1 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +231,7 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketNEIRecipe(NBTTagCompound recipe) throws IOException
|
||||
public PacketNEIRecipe( NBTTagCompound recipe ) throws IOException
|
||||
{
|
||||
ByteBuf data = Unpooled.buffer();
|
||||
|
||||
|
||||
@@ -101,14 +101,14 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
priorityList.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
this.myWhitelist = hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
this.setWhitelist( hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
|
||||
|
||||
if ( !priorityList.isEmpty() )
|
||||
{
|
||||
if ( hasFuzzy )
|
||||
this.myPartitionList = new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode );
|
||||
this.setPartitionList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ) );
|
||||
else
|
||||
this.myPartitionList = new PrecisePriorityList<IAEItemStack>( priorityList );
|
||||
this.setPartitionList( new PrecisePriorityList<IAEItemStack>( priorityList ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,19 +116,19 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
@Override
|
||||
public boolean isPreformatted()
|
||||
{
|
||||
return ! this.myPartitionList.isEmpty();
|
||||
return ! this.getPartitionList().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFuzzy()
|
||||
{
|
||||
return this.myPartitionList instanceof FuzzyPriorityList;
|
||||
return this.getPartitionList() instanceof FuzzyPriorityList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IncludeExclude getIncludeExcludeMode()
|
||||
{
|
||||
return this.myWhitelist;
|
||||
return this.getWhitelist();
|
||||
}
|
||||
|
||||
public int getStatusForCell()
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.me.storage;
|
||||
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.IncludeExclude;
|
||||
@@ -31,6 +32,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.prioitylist.DefaultPriorityList;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
|
||||
|
||||
public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHandler<T>
|
||||
{
|
||||
|
||||
@@ -38,24 +40,78 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
final protected IMEMonitor<T> monitor;
|
||||
final protected IMEInventoryHandler<T> internal;
|
||||
|
||||
public int myPriority = 0;
|
||||
public IncludeExclude myWhitelist = IncludeExclude.WHITELIST;
|
||||
public AccessRestriction myAccess = AccessRestriction.READ_WRITE;
|
||||
public IPartitionList<T> myPartitionList = new DefaultPriorityList<T>();
|
||||
private int myPriority;
|
||||
private IncludeExclude myWhitelist;
|
||||
private AccessRestriction myAccess;
|
||||
private IPartitionList<T> myPartitionList;
|
||||
|
||||
public MEInventoryHandler(IMEInventory<T> i, StorageChannel channel) {
|
||||
private AccessRestriction cachedAccessRestriction;
|
||||
private boolean hasReadAccess;
|
||||
private boolean hasWriteAccess;
|
||||
|
||||
public MEInventoryHandler( IMEInventory<T> i, StorageChannel channel )
|
||||
{
|
||||
this.channel = channel;
|
||||
|
||||
if ( i instanceof IMEInventoryHandler )
|
||||
this.internal = (IMEInventoryHandler<T>) i;
|
||||
this.internal = ( IMEInventoryHandler<T> ) i;
|
||||
else
|
||||
this.internal = new MEPassThrough<T>( i, channel );
|
||||
|
||||
this.monitor = this.internal instanceof IMEMonitor ? (IMEMonitor<T>) this.internal : null;
|
||||
this.monitor = this.internal instanceof IMEMonitor ? ( IMEMonitor<T> ) this.internal : null;
|
||||
|
||||
this.setPriority( 0 );
|
||||
this.setWhitelist( IncludeExclude.WHITELIST );
|
||||
this.setBaseAccess( AccessRestriction.READ_WRITE );
|
||||
this.setPartitionList( new DefaultPriorityList<T>() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public T injectItems(T input, Actionable type, BaseActionSource src)
|
||||
public int getPriority()
|
||||
{
|
||||
return this.myPriority;
|
||||
}
|
||||
|
||||
public void setPriority( int myPriority )
|
||||
{
|
||||
this.myPriority = myPriority;
|
||||
}
|
||||
|
||||
public IncludeExclude getWhitelist()
|
||||
{
|
||||
return this.myWhitelist;
|
||||
}
|
||||
|
||||
public void setWhitelist( IncludeExclude myWhitelist )
|
||||
{
|
||||
this.myWhitelist = myWhitelist;
|
||||
}
|
||||
|
||||
public AccessRestriction getBaseAccess()
|
||||
{
|
||||
return this.myAccess;
|
||||
}
|
||||
|
||||
public void setBaseAccess( AccessRestriction myAccess )
|
||||
{
|
||||
this.myAccess = myAccess;
|
||||
this.cachedAccessRestriction = this.myAccess.restrictPermissions( this.internal.getAccess() );
|
||||
this.hasReadAccess = this.getAccess().hasPermission( AccessRestriction.READ );
|
||||
this.hasWriteAccess = this.getAccess().hasPermission( AccessRestriction.WRITE );
|
||||
}
|
||||
|
||||
public IPartitionList<T> getPartitionList()
|
||||
{
|
||||
return this.myPartitionList;
|
||||
}
|
||||
|
||||
public void setPartitionList( IPartitionList<T> myPartitionList )
|
||||
{
|
||||
this.myPartitionList = myPartitionList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T injectItems( T input, Actionable type, BaseActionSource src )
|
||||
{
|
||||
if ( !this.canAccept( input ) )
|
||||
return input;
|
||||
@@ -64,18 +120,18 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
}
|
||||
|
||||
@Override
|
||||
public T extractItems(T request, Actionable type, BaseActionSource src)
|
||||
public T extractItems( T request, Actionable type, BaseActionSource src )
|
||||
{
|
||||
if ( !this.getAccess().hasPermission( AccessRestriction.READ ) )
|
||||
if ( !hasReadAccess )
|
||||
return null;
|
||||
|
||||
return this.internal.extractItems( request, type, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<T> getAvailableItems(IItemList<T> out)
|
||||
public IItemList<T> getAvailableItems( IItemList<T> out )
|
||||
{
|
||||
if ( !this.getAccess().hasPermission( AccessRestriction.READ ) )
|
||||
if ( !hasReadAccess )
|
||||
return out;
|
||||
|
||||
return this.internal.getAvailableItems( out );
|
||||
@@ -90,11 +146,11 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
@Override
|
||||
public AccessRestriction getAccess()
|
||||
{
|
||||
return this.myAccess.restrictPermissions( this.internal.getAccess() );
|
||||
return this.cachedAccessRestriction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized(T input)
|
||||
public boolean isPrioritized( T input )
|
||||
{
|
||||
if ( this.myWhitelist == IncludeExclude.WHITELIST )
|
||||
return this.myPartitionList.isListed( input ) || this.internal.isPrioritized( input );
|
||||
@@ -102,9 +158,9 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept(T input)
|
||||
public boolean canAccept( T input )
|
||||
{
|
||||
if ( !this.getAccess().hasPermission( AccessRestriction.WRITE ) )
|
||||
if ( !hasWriteAccess )
|
||||
return false;
|
||||
|
||||
if ( this.myWhitelist == IncludeExclude.BLACKLIST && this.myPartitionList.isListed( input ) )
|
||||
@@ -114,12 +170,6 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
return this.myPartitionList.isListed( input ) && this.internal.canAccept( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
return this.myPriority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlot()
|
||||
{
|
||||
@@ -132,7 +182,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validForPass(int i)
|
||||
public boolean validForPass( int i )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
@@ -64,7 +65,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
public NetworkInventoryHandler(StorageChannel chan, SecurityCache security) {
|
||||
this.myChannel = chan;
|
||||
this.security = security;
|
||||
this.priorityInventory = new ConcurrentSkipListMap<Integer, List<IMEInventoryHandler<T>>>( PRIORITY_SORTER ); // TreeMultimap.create( prioritySorter, hashSorter );
|
||||
this.priorityInventory = new TreeMap<Integer, List<IMEInventoryHandler<T>>>( PRIORITY_SORTER ); // TreeMultimap.create( prioritySorter, hashSorter );
|
||||
}
|
||||
|
||||
public void addNewStorage(IMEInventoryHandler<T> h)
|
||||
|
||||
@@ -313,9 +313,10 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
|
||||
private void updateHandler()
|
||||
{
|
||||
this.myHandler.myAccess = AccessRestriction.WRITE;
|
||||
this.myHandler.myWhitelist = this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
this.myHandler.myPriority = this.priority;
|
||||
this.myHandler.setBaseAccess( AccessRestriction.WRITE );
|
||||
;
|
||||
this.myHandler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
|
||||
this.myHandler.setPriority( this.priority );
|
||||
|
||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
|
||||
@@ -328,9 +329,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
}
|
||||
|
||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
this.myHandler.myPartitionList = new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) );
|
||||
this.myHandler.setPartitionList( new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
|
||||
else
|
||||
this.myHandler.myPartitionList = new PrecisePriorityList( priorityList );
|
||||
this.myHandler.setPartitionList( new PrecisePriorityList( priorityList ) );
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -319,9 +319,9 @@ public class PartStorageBus
|
||||
|
||||
this.handler = new MEInventoryHandler( inv, StorageChannel.ITEMS );
|
||||
|
||||
this.handler.myAccess = ( AccessRestriction ) this.getConfigManager().getSetting( Settings.ACCESS );
|
||||
this.handler.myWhitelist = this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
this.handler.myPriority = this.priority;
|
||||
this.handler.setBaseAccess( ( AccessRestriction ) this.getConfigManager().getSetting( Settings.ACCESS ) );;
|
||||
this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
|
||||
this.handler.setPriority( this.priority );
|
||||
|
||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
|
||||
@@ -334,9 +334,9 @@ public class PartStorageBus
|
||||
}
|
||||
|
||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
this.handler.myPartitionList = new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) );
|
||||
this.handler.setPartitionList( new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
|
||||
else
|
||||
this.handler.myPartitionList = new PrecisePriorityList( priorityList );
|
||||
this.handler.setPartitionList ( new PrecisePriorityList( priorityList ));
|
||||
|
||||
if ( inv instanceof IMEMonitor )
|
||||
( ( IMEMonitor ) inv ).addListener( this, this.handler );
|
||||
|
||||
@@ -427,7 +427,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
return null;
|
||||
|
||||
MEInventoryHandler ih = new MEInventoryHandler( h, h.getChannel() );
|
||||
ih.myPriority = this.priority;
|
||||
ih.setPriority( this.priority );
|
||||
|
||||
MEMonitorHandler<StackType> g = new ChestMonitorHandler<StackType>( ih );
|
||||
g.addListener( new ChestNetNotifier( h.getChannel() ), g );
|
||||
|
||||
@@ -245,7 +245,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
|
||||
|
||||
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
|
||||
ih.myPriority = this.priority;
|
||||
ih.setPriority( this.priority );
|
||||
this.invBySlot[x] = ih;
|
||||
this.items.add( ih );
|
||||
}
|
||||
@@ -258,7 +258,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
|
||||
|
||||
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
|
||||
ih.myPriority = this.priority;
|
||||
ih.setPriority( this.priority );
|
||||
this.invBySlot[x] = ih;
|
||||
this.fluids.add( ih );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class AEItemDef
|
||||
|
||||
public int def;
|
||||
|
||||
private final int itemID;
|
||||
public final int itemID;
|
||||
public final Item item;
|
||||
public int damageValue;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class AEItemDef
|
||||
|
||||
public AEItemDef(Item it) {
|
||||
this.item = it;
|
||||
this.itemID = System.identityHashCode( this.item );
|
||||
this.itemID = Item.getIdFromItem( it );
|
||||
}
|
||||
|
||||
public AEItemDef copy()
|
||||
|
||||
@@ -261,11 +261,19 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
@Override
|
||||
public int compareTo(AEItemStack b)
|
||||
{
|
||||
int id = this.compare( this.def.item.hashCode(), b.def.item.hashCode() );
|
||||
int damageValue = this.compare( this.def.damageValue, b.def.damageValue );
|
||||
int displayDamage = this.compare( this.def.displayDamage, b.def.displayDamage );
|
||||
// AELog.info( "NBT: " + nbt );
|
||||
return id == 0 ? (damageValue == 0 ? (displayDamage == 0 ? this.compareNBT( b.def ) : displayDamage) : damageValue) : id;
|
||||
int id = this.def.itemID - b.def.itemID;
|
||||
if (id != 0)
|
||||
return id;
|
||||
|
||||
int damageValue = this.def.damageValue - b.def.damageValue ;
|
||||
if (damageValue != 0)
|
||||
return damageValue;
|
||||
|
||||
int displayDamage = this.def.displayDamage - b.def.displayDamage;
|
||||
if (displayDamage != 0)
|
||||
return displayDamage;
|
||||
|
||||
return (this.def.tagCompound == b.def.tagCompound) ? 0 : this.compareNBT( b.def );
|
||||
}
|
||||
|
||||
private int compareNBT(AEItemDef b)
|
||||
@@ -276,7 +284,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
return nbt;
|
||||
}
|
||||
|
||||
private int compare(int l, long m)
|
||||
private int compare(int l, int m)
|
||||
{
|
||||
return l < m ? -1 : (l > m ? 1 : 0);
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ public class OreHelper
|
||||
|
||||
for ( String ore : OreDictionary.getOreNames() )
|
||||
{
|
||||
// skip ore if it is a match already.
|
||||
if ( toAdd.contains( ore ) )
|
||||
// skip ore if it is a match already or null.
|
||||
if ( ore == null || toAdd.contains( ore ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,9 @@ chat.appliedenergistics2.OutOfRange=超出无线信号范围.
|
||||
chat.appliedenergistics2.InvalidMachine=无效机器.
|
||||
chat.appliedenergistics2.LoadedSettings=成功载入设定.
|
||||
chat.appliedenergistics2.DeviceNotPowered=设备供能不足.
|
||||
chat.appliedenergistics2.DeviceNotWirelessTerminal=设备不是无线终端.
|
||||
chat.appliedenergistics2.DeviceNotLinked=设备未连接.
|
||||
chat.appliedenergistics2.StationCanNotBeLocated=无法定位安全终端.
|
||||
chat.appliedenergistics2.MachineNotPowered=机器未供能.
|
||||
chat.appliedenergistics2.CommunicationError=网络交互错误.
|
||||
chat.appliedenergistics2.SavedSettings=成功保存设定.
|
||||
@@ -194,7 +197,7 @@ gui.appliedenergistics2.NoCraftingCPUs=没有可用的合成CPU...
|
||||
gui.appliedenergistics2.CalculatingWait=正在计算,请等待...
|
||||
gui.appliedenergistics2.Clean=清空
|
||||
gui.appliedenergistics2.InvalidPattern=无效样板
|
||||
gui.appliedenergistics2.Range=Range
|
||||
gui.appliedenergistics2.Range=范围
|
||||
gui.appliedenergistics2.TransparentFacades=透明的伪装板
|
||||
gui.appliedenergistics2.TransparentFacadesHint=控制当网络工具放在快捷栏时,伪装板显示的透明度.
|
||||
gui.appliedenergistics2.CPUs=CPU
|
||||
@@ -252,7 +255,7 @@ gui.tooltips.appliedenergistics2.AlwaysActive=总是激活
|
||||
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=无信号时激活
|
||||
gui.tooltips.appliedenergistics2.ActiveWithSignal=有信号时激活
|
||||
gui.tooltips.appliedenergistics2.ActiveOnPulse=有脉冲信号时激活
|
||||
gui.tooltips.appliedenergistics2.EmitLevelsBelow=当容量标准小于等于设定限制时发出信号.
|
||||
gui.tooltips.appliedenergistics2.EmitLevelsBelow=当容量标准小于设定限制时发出信号.
|
||||
gui.tooltips.appliedenergistics2.EmitLevelAbove=当容量标准大于等于设定限制时发出信号.
|
||||
gui.tooltips.appliedenergistics2.SearchMode_Auto=自动搜索
|
||||
gui.tooltips.appliedenergistics2.SearchMode_Standard=标准搜索
|
||||
@@ -288,6 +291,9 @@ gui.tooltips.appliedenergistics2.EmitWhenCrafting=在物品合成时发射红石
|
||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=报告不可交互的物品
|
||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=是: 显示无法取出的物品.
|
||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=否: 只显示可以取出的物品.
|
||||
gui.tooltips.appliedenergistics2.BlockPlacement=方块放置方式
|
||||
gui.tooltips.appliedenergistics2.BlockPlacementYes=方块将被放置.
|
||||
gui.tooltips.appliedenergistics2.BlockPlacementNo=方块将以物品形式掉落.
|
||||
|
||||
gui.appliedenergistics2.units.appliedenergstics=AE
|
||||
gui.appliedenergistics2.units.buildcraft=MJ
|
||||
@@ -322,6 +328,7 @@ waila.appliedenergistics2.Unlocked=未锁定
|
||||
waila.appliedenergistics2.Showing=显示
|
||||
waila.appliedenergistics2.Contains=容纳
|
||||
waila.appliedenergistics2.Channels=频道
|
||||
waila.appliedenergistics2.Crafting=合成中
|
||||
|
||||
item.appliedenergistics2.ItemBasicStorageCell.1k.name=1k-ME存储元件
|
||||
item.appliedenergistics2.ItemBasicStorageCell.4k.name=4k-ME存储元件
|
||||
|
||||
Reference in New Issue
Block a user