Improved NEI Integration and Pattern Terminal Support
This commit is contained in:
@@ -10,6 +10,7 @@ import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.INEI;
|
||||
@@ -64,9 +65,11 @@ public class NEI extends BaseModule implements IIntegrationModule, INEI
|
||||
|
||||
Method registerGuiOverlayHandler = API.getDeclaredMethod( "registerGuiOverlayHandler", new Class[] { Class.class, IOverlayHandler, String.class } );
|
||||
registerGuiOverlay.invoke( API, GuiCraftingTerm.class, "crafting", 6, 75 );
|
||||
registerGuiOverlay.invoke( API, GuiPatternTerm.class, "crafting", 6, 75 );
|
||||
|
||||
Constructor DefaultOverlayHandlerConstructor = DefaultOverlayHandler.getConstructor( new Class[] { int.class, int.class } );
|
||||
registerGuiOverlayHandler.invoke( API, GuiCraftingTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" );
|
||||
registerGuiOverlayHandler.invoke( API, GuiPatternTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,9 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIRecipe;
|
||||
import codechicken.nei.PositionedStack;
|
||||
@@ -47,7 +49,7 @@ public class NEICraftingHandler implements IOverlayHandler
|
||||
{
|
||||
NBTTagCompound recipe = new NBTTagCompound();
|
||||
|
||||
if ( gui instanceof GuiCraftingTerm )
|
||||
if ( gui instanceof GuiCraftingTerm || gui instanceof GuiPatternTerm )
|
||||
{
|
||||
for (int i = 0; i < ingredients.size(); i++)// identify slots
|
||||
{
|
||||
@@ -58,14 +60,14 @@ public class NEICraftingHandler implements IOverlayHandler
|
||||
{
|
||||
for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots)
|
||||
{
|
||||
if ( slot instanceof SlotCraftingMatrix )
|
||||
if ( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix )
|
||||
{
|
||||
SlotCraftingMatrix ctSlot = (SlotCraftingMatrix) slot;
|
||||
Slot ctSlot = (Slot) slot;
|
||||
if ( ctSlot.getSlotIndex() == col + row * 3 )
|
||||
{
|
||||
NBTTagCompound inbt = new NBTTagCompound();
|
||||
pstack.item.writeToNBT( inbt );
|
||||
recipe.setTag( "#" + ((SlotCraftingMatrix) slot).getSlotIndex(), inbt );
|
||||
recipe.setTag( "#" + ctSlot.getSlotIndex(), inbt );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user