Merge branch 'rv1' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv2
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
@@ -12,6 +14,7 @@ import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIRecipe;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
@@ -19,7 +22,8 @@ import codechicken.nei.recipe.IRecipeHandler;
|
||||
public class NEICraftingHandler implements IOverlayHandler
|
||||
{
|
||||
|
||||
public NEICraftingHandler(int x, int y) {
|
||||
public NEICraftingHandler(int x, int y)
|
||||
{
|
||||
offsetx = x;
|
||||
offsety = y;
|
||||
}
|
||||
@@ -66,12 +70,24 @@ public class NEICraftingHandler implements IOverlayHandler
|
||||
if ( ctSlot.getSlotIndex() == col + row * 3 )
|
||||
{
|
||||
NBTTagList ilist = new NBTTagList();
|
||||
List<ItemStack> list = new LinkedList();
|
||||
|
||||
// prefer pure crystals.
|
||||
for (int x = 0; x < pstack.items.length; x++)
|
||||
{
|
||||
if ( Platform.isRecipePrioritized( pstack.items[x] ) )
|
||||
list.add( 0, pstack.items[x] );
|
||||
else
|
||||
list.add( pstack.items[x] );
|
||||
}
|
||||
|
||||
for (ItemStack is : list)
|
||||
{
|
||||
NBTTagCompound inbt = new NBTTagCompound();
|
||||
pstack.items[x].writeToNBT( inbt );
|
||||
is.writeToNBT( inbt );
|
||||
ilist.appendTag( inbt );
|
||||
}
|
||||
|
||||
recipe.setTag( "#" + ctSlot.getSlotIndex(), ilist );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package appeng.integration.modules.dead;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
public class Forestry implements IIntegrationModule
|
||||
{
|
||||
|
||||
public static Forestry instance;
|
||||
|
||||
@Override
|
||||
public void Init()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void PostInit()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package appeng.integration.modules;
|
||||
|
||||
import gregtech.api.interfaces.tileentity.IDigitalChest;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.IGT;
|
||||
import appeng.integration.modules.helpers.GregTechHandler;
|
||||
import appeng.integration.modules.helpers.GregTechQuantumChest;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
public class GT implements IGT, IIntegrationModule
|
||||
{
|
||||
|
||||
public static GT instance;
|
||||
|
||||
@Override
|
||||
public IMEInventory getQuantumChest(TileEntity te)
|
||||
{
|
||||
return new GregTechQuantumChest( (IInventory) te, InventoryAdaptor.getAdaptor( te, ForgeDirection.NORTH ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQuantumChest(TileEntity te)
|
||||
{
|
||||
if ( te instanceof IDigitalChest )
|
||||
return ((IDigitalChest) te).isDigitalChest();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void PostInit()
|
||||
{
|
||||
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new GregTechHandler() );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package appeng.integration.modules.dead;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
public class LP implements IIntegrationModule
|
||||
{
|
||||
|
||||
public static LP instance;
|
||||
|
||||
@Override
|
||||
public void Init()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void PostInit()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package appeng.integration.modules.dead;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
public class Mystcraft implements IIntegrationModule
|
||||
{
|
||||
|
||||
public static Mystcraft instance;
|
||||
|
||||
@Override
|
||||
public void Init()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void PostInit()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package appeng.integration.modules.helpers.dead;
|
||||
|
||||
import appeng.api.features.IItemComparison;
|
||||
import appeng.api.integration.IBeeComparison;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public class ForestryGeneticsComparison implements IItemComparison, IBeeComparison
|
||||
{
|
||||
|
||||
IIndividual idiv;
|
||||
String Species;
|
||||
|
||||
@Override
|
||||
public IIndividual getIndividual()
|
||||
{
|
||||
return idiv;
|
||||
}
|
||||
|
||||
public ForestryGeneticsComparison(IIndividual _idiv) {
|
||||
idiv = _idiv;
|
||||
Species = _idiv.getGenome().getActiveAllele( EnumTreeChromosome.SPECIES.ordinal() ).getUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsPrecise(IItemComparison comp)
|
||||
{
|
||||
if ( comp instanceof ForestryGeneticsComparison )
|
||||
{
|
||||
IIndividual op = ((ForestryGeneticsComparison) comp).idiv;
|
||||
if ( idiv.isAnalyzed() == op.isAnalyzed() )
|
||||
return idiv.isGeneticEqual( op );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsFuzzy(IItemComparison comp)
|
||||
{
|
||||
if ( comp instanceof ForestryGeneticsComparison )
|
||||
return Species.equals( ((ForestryGeneticsComparison) comp).Species );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package appeng.integration.modules.helpers.dead;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.features.IItemComparisionProvider;
|
||||
import appeng.api.features.IItemComparison;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public class ForestryGeneticsProvider implements IItemComparisionProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public IItemComparison getComparison(ItemStack is)
|
||||
{
|
||||
if ( forestry.api.genetics.AlleleManager.alleleRegistry != null )
|
||||
{
|
||||
IIndividual idiv = forestry.api.genetics.AlleleManager.alleleRegistry.getIndividual( is );
|
||||
if ( idiv == null )
|
||||
return null;
|
||||
return new ForestryGeneticsComparison( idiv );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(ItemStack stack)
|
||||
{
|
||||
if ( forestry.api.genetics.AlleleManager.alleleRegistry != null )
|
||||
return forestry.api.genetics.AlleleManager.alleleRegistry.isIndividual( stack );
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.integration.modules.GT;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.util.inv.IMEAdaptor;
|
||||
|
||||
public class GregTechHandler implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan)
|
||||
{
|
||||
return chan == StorageChannel.ITEMS && GT.instance.isQuantumChest( te );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src)
|
||||
{
|
||||
if ( channel == StorageChannel.ITEMS )
|
||||
return new MEMonitorIInventory( new IMEAdaptor( GT.instance.getQuantumChest( te ) ) );
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
import gregtech.api.interfaces.tileentity.IDigitalChest;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.storage.MEIInventoryWrapper;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class GregTechQuantumChest extends MEIInventoryWrapper
|
||||
{
|
||||
|
||||
IDigitalChest qc;
|
||||
|
||||
public GregTechQuantumChest(IInventory m, InventoryAdaptor ia) {
|
||||
super( m, ia );
|
||||
qc = (IDigitalChest) m;
|
||||
}
|
||||
|
||||
private ItemStack getType()
|
||||
{
|
||||
ItemStack[] array = qc.getStoredItemData();
|
||||
if ( array.length > 0 && array[0].getItem() != null )
|
||||
return array[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
ItemStack type = getType();
|
||||
if ( input.hasTagCompound() )
|
||||
return input;
|
||||
|
||||
if ( type == null )
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
if ( (type.getItem() == input.getItem() && type.getItemDamage() == input.getItemDamage()) )
|
||||
{
|
||||
if ( type.stackSize < qc.getMaxItemCount() )
|
||||
{
|
||||
int room = (int) ((long) qc.getMaxItemCount() - (long) type.stackSize);
|
||||
if ( input.getStackSize() > room )
|
||||
{
|
||||
IAEItemStack is = input.copy();
|
||||
is.setStackSize( is.getStackSize() - room );
|
||||
if ( mode == Actionable.MODULATE )
|
||||
qc.setItemCount( type.stackSize + room );
|
||||
|
||||
return super.injectItems( is, mode, src );
|
||||
}
|
||||
|
||||
if ( mode == Actionable.MODULATE )
|
||||
qc.setItemCount( type.stackSize + (int) input.getStackSize() );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return super.injectItems( input, mode, src );
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack i, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
ItemStack type = getType();
|
||||
if ( type != null )
|
||||
{
|
||||
if ( type.getItem() == i.getItem() && type.getItemDamage() == i.getItemDamage() )
|
||||
{
|
||||
if ( type.stackSize > i.getStackSize() )
|
||||
{
|
||||
IAEItemStack output = AEItemStack.create( type );
|
||||
output.setStackSize( (int) i.getStackSize() );
|
||||
if ( mode == Actionable.MODULATE )
|
||||
qc.setItemCount( type.stackSize - (int) output.getStackSize() );
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.extractItems( i, mode, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList getAvailableItems(IItemList out)
|
||||
{
|
||||
ItemStack type = getType();
|
||||
if ( type != null )
|
||||
{
|
||||
super.getAvailableItems( out );
|
||||
if ( type != null && type.stackSize > 0 )
|
||||
out.addStorage( AEItemStack.create( type ) );
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user