mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
CraftingStation side chest now work with any IInventory with a configurable blacklist. (#35)
* CraftingStation side chest now work with any IInventory with a configurable blacklist. * Check ISidedInventory and accessible slots. Still needs some work for shift clicking. * Backport shift click behavior and some helper functions * Fix NEI overlap, and tinker's tool station integration * Fix NEI shift clicking by redoing math
This commit is contained in:
1 parent
1c305ff293
commit
1c46541223
14 files changed
+1455
-499
No files matched your search
@@ -5,9 +5,7 @@ import codechicken.nei.recipe.IRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
import tconstruct.tools.gui.ToolStationGui;
|
||||
import tconstruct.tools.inventory.CraftingStationContainer;
|
||||
import tconstruct.tools.inventory.ToolStationContainer;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
|
||||
/**
|
||||
@@ -18,8 +16,9 @@ public class CraftingStationOverlayHandler extends DefaultOverlayHandler
|
||||
@Override
|
||||
public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift) {
|
||||
if(gui.inventorySlots instanceof CraftingStationContainer) {
|
||||
if(((CraftingStationContainer) gui.inventorySlots).logic.chest != null) {
|
||||
offsetx = 5 + CraftingStationGui.CHEST_WIDTH;
|
||||
final CraftingStationContainer station = (CraftingStationContainer)gui.inventorySlots;
|
||||
if(station.logic.chest != null && gui instanceof CraftingStationGui) {
|
||||
offsetx = 5 + ((CraftingStationGui)gui).getChestWidth();
|
||||
}
|
||||
else {
|
||||
offsetx = 5;
|
||||
|
||||
@@ -1,38 +1,33 @@
|
||||
package tconstruct.plugins.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
|
||||
public class CraftingStationStackPositioner implements IStackPositioner
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CraftingStationStackPositioner implements IStackPositioner {
|
||||
|
||||
@Override
|
||||
public ArrayList<PositionedStack> positionStacks (ArrayList<PositionedStack> stacks)
|
||||
{
|
||||
public ArrayList<PositionedStack> positionStacks (ArrayList<PositionedStack> stacks) {
|
||||
|
||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiRecipe)
|
||||
{
|
||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiRecipe) {
|
||||
GuiRecipe recipeGui = (GuiRecipe) Minecraft.getMinecraft().currentScreen;
|
||||
|
||||
if (!(recipeGui.firstGui instanceof CraftingStationGui))
|
||||
{
|
||||
if (!(recipeGui.firstGui instanceof CraftingStationGui)) {
|
||||
TConstruct.logger.warn("No CraftingStationGui found!");
|
||||
return stacks;
|
||||
}
|
||||
|
||||
CraftingStationGui gui = (CraftingStationGui) recipeGui.firstGui;
|
||||
|
||||
int offsetX = gui.hasChest() ? 5 + CraftingStationGui.CHEST_WIDTH : 5;
|
||||
int offsetX = gui.hasChest() ? 5 + gui.getChestWidth() : 5;
|
||||
int offsetY = 11;
|
||||
|
||||
for (PositionedStack stack : stacks)
|
||||
{
|
||||
for (PositionedStack stack : stacks) {
|
||||
stack.relx += offsetX;
|
||||
stack.rely += offsetY;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user