Fixed NEI Ghost Overlays.
This commit is contained in:
@@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
@@ -28,6 +29,8 @@ import appeng.client.me.InternalSlotME;
|
|||||||
import appeng.client.me.ItemRepo;
|
import appeng.client.me.ItemRepo;
|
||||||
import appeng.container.implementations.ContainerMEMonitorable;
|
import appeng.container.implementations.ContainerMEMonitorable;
|
||||||
import appeng.container.slot.AppEngSlot;
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
@@ -46,6 +49,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
MEGuiTextField searchField;
|
MEGuiTextField searchField;
|
||||||
private static String memoryText = "";
|
private static String memoryText = "";
|
||||||
|
|
||||||
|
public static int CraftingGridOffsetX;
|
||||||
|
public static int CraftingGridOffsetY;
|
||||||
|
|
||||||
ItemRepo repo;
|
ItemRepo repo;
|
||||||
|
|
||||||
GuiText myName;
|
GuiText myName;
|
||||||
@@ -232,6 +238,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
setScrollBar();
|
setScrollBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CraftingGridOffsetX = Integer.MAX_VALUE;
|
||||||
|
CraftingGridOffsetY = Integer.MAX_VALUE;
|
||||||
|
|
||||||
for (Object s : inventorySlots.inventorySlots)
|
for (Object s : inventorySlots.inventorySlots)
|
||||||
{
|
{
|
||||||
if ( s instanceof AppEngSlot )
|
if ( s instanceof AppEngSlot )
|
||||||
@@ -239,8 +248,20 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
if ( ((AppEngSlot) s).xDisplayPosition < 197 )
|
if ( ((AppEngSlot) s).xDisplayPosition < 197 )
|
||||||
repositionSlot( (AppEngSlot) s );
|
repositionSlot( (AppEngSlot) s );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix )
|
||||||
|
{
|
||||||
|
Slot g = (Slot) s;
|
||||||
|
if ( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 )
|
||||||
|
{
|
||||||
|
CraftingGridOffsetX = Math.min( CraftingGridOffsetX, g.xDisplayPosition );
|
||||||
|
CraftingGridOffsetY = Math.min( CraftingGridOffsetY, g.yDisplayPosition );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CraftingGridOffsetX -= 25;
|
||||||
|
CraftingGridOffsetY -= 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void repositionSlot(AppEngSlot s)
|
protected void repositionSlot(AppEngSlot s)
|
||||||
|
|||||||
@@ -5,11 +5,8 @@ import java.io.IOException;
|
|||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.common.config.ConfigCategory;
|
import net.minecraftforge.common.config.ConfigCategory;
|
||||||
@@ -22,6 +19,8 @@ import appeng.me.GridStorage;
|
|||||||
import appeng.me.GridStorageSearch;
|
import appeng.me.GridStorageSearch;
|
||||||
import appeng.services.CompassService;
|
import appeng.services.CompassService;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
public class WorldSettings extends Configuration
|
public class WorldSettings extends Configuration
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -244,7 +243,7 @@ public class WorldSettings extends Configuration
|
|||||||
if ( playerList == null || profile == null || !profile.isComplete() )
|
if ( playerList == null || profile == null || !profile.isComplete() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
String uuid = profile.getId().toString();
|
String uuid = profile.getId().toString();
|
||||||
|
|
||||||
Property prop = playerList.get( uuid );
|
Property prop = playerList.get( uuid );
|
||||||
if ( prop != null && prop.isIntValue() )
|
if ( prop != null && prop.isIntValue() )
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import appeng.integration.modules.NEIHelpers.NEICraftingHandler;
|
|||||||
import appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler;
|
import appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler;
|
||||||
import appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler;
|
import appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler;
|
||||||
import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler;
|
import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler;
|
||||||
|
import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder;
|
||||||
|
import codechicken.nei.api.IStackPositioner;
|
||||||
import codechicken.nei.guihook.GuiContainerManager;
|
import codechicken.nei.guihook.GuiContainerManager;
|
||||||
|
|
||||||
public class NEI extends BaseModule implements IIntegrationModule, INEI
|
public class NEI extends BaseModule implements IIntegrationModule, INEI
|
||||||
@@ -59,13 +61,13 @@ public class NEI extends BaseModule implements IIntegrationModule, INEI
|
|||||||
registerRecipeHandler( new NEIGrinderRecipeHandler() );
|
registerRecipeHandler( new NEIGrinderRecipeHandler() );
|
||||||
|
|
||||||
// crafting terminal...
|
// crafting terminal...
|
||||||
Method registerGuiOverlay = API.getDeclaredMethod( "registerGuiOverlay", new Class[] { Class.class, String.class, int.class, int.class } );
|
Method registerGuiOverlay = API.getDeclaredMethod( "registerGuiOverlay", new Class[] { Class.class, String.class, IStackPositioner.class } );
|
||||||
Class IOverlayHandler = Class.forName( "codechicken.nei.api.IOverlayHandler" );
|
Class IOverlayHandler = Class.forName( "codechicken.nei.api.IOverlayHandler" );
|
||||||
Class DefaultOverlayHandler = NEICraftingHandler.class;
|
Class DefaultOverlayHandler = NEICraftingHandler.class;
|
||||||
|
|
||||||
Method registerGuiOverlayHandler = API.getDeclaredMethod( "registerGuiOverlayHandler", new Class[] { Class.class, IOverlayHandler, String.class } );
|
Method registerGuiOverlayHandler = API.getDeclaredMethod( "registerGuiOverlayHandler", new Class[] { Class.class, IOverlayHandler, String.class } );
|
||||||
registerGuiOverlay.invoke( API, GuiCraftingTerm.class, "crafting", 6, 75 );
|
registerGuiOverlay.invoke( API, GuiCraftingTerm.class, "crafting", new TerminalCraftingSlotFinder() );
|
||||||
registerGuiOverlay.invoke( API, GuiPatternTerm.class, "crafting", 6, 75 );
|
registerGuiOverlay.invoke( API, GuiPatternTerm.class, "crafting", new TerminalCraftingSlotFinder() );
|
||||||
|
|
||||||
Constructor DefaultOverlayHandlerConstructor = DefaultOverlayHandler.getConstructor( new Class[] { int.class, int.class } );
|
Constructor DefaultOverlayHandlerConstructor = DefaultOverlayHandler.getConstructor( new Class[] { int.class, int.class } );
|
||||||
registerGuiOverlayHandler.invoke( API, GuiCraftingTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" );
|
registerGuiOverlayHandler.invoke( API, GuiCraftingTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" );
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class NEICraftingHandler implements IOverlayHandler
|
|||||||
int offsetx;
|
int offsetx;
|
||||||
int offsety;
|
int offsety;
|
||||||
|
|
||||||
// @override
|
@Override
|
||||||
public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift)
|
public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -42,7 +42,6 @@ public class NEICraftingHandler implements IOverlayHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @override
|
|
||||||
public void overlayRecipe(GuiContainer gui, List<PositionedStack> ingredients, boolean shift)
|
public void overlayRecipe(GuiContainer gui, List<PositionedStack> ingredients, boolean shift)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package appeng.integration.modules.NEIHelpers;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||||
|
import codechicken.nei.PositionedStack;
|
||||||
|
import codechicken.nei.api.IStackPositioner;
|
||||||
|
|
||||||
|
public class TerminalCraftingSlotFinder implements IStackPositioner
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<PositionedStack> positionStacks(ArrayList<PositionedStack> a)
|
||||||
|
{
|
||||||
|
for (PositionedStack ps : a)
|
||||||
|
if ( ps != null )
|
||||||
|
{
|
||||||
|
ps.relx += GuiMEMonitorable.CraftingGridOffsetX;
|
||||||
|
ps.rely += GuiMEMonitorable.CraftingGridOffsetY;
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user