mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +00:00
Add Autocrafting to Crafting Station (#185)
Co-authored-by: Caedis <Caedis@users.noreply.github.com>
This commit is contained in:
1 parent
286b4cb42c
commit
740aa65de7
1 file changed
+13
-8
@@ -15,23 +15,28 @@ import tconstruct.tools.logic.CraftingStationLogic;
|
||||
public class CraftingStationOverlayHandler extends DefaultOverlayHandler {
|
||||
|
||||
@Override
|
||||
public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift) {
|
||||
if (gui.inventorySlots instanceof CraftingStationContainer) {
|
||||
final CraftingStationContainer station = (CraftingStationContainer) gui.inventorySlots;
|
||||
if (station.logic.chest != null && gui instanceof CraftingStationGui) {
|
||||
offsetx = 5 + ((CraftingStationGui) gui).getChestWidth();
|
||||
public void overlayRecipe(GuiContainer gui, IRecipeHandler handler, int recipeIndex, boolean maxTransfer) {
|
||||
transferRecipe(gui, handler, recipeIndex, maxTransfer ? Integer.MAX_VALUE : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int transferRecipe(GuiContainer gui, IRecipeHandler handler, int recipeIndex, int multiplier) {
|
||||
|
||||
if (gui.inventorySlots instanceof CraftingStationContainer stationContainer) {
|
||||
if (stationContainer.logic.chest != null && gui instanceof CraftingStationGui stationGui) {
|
||||
offsetx = 5 + stationGui.getChestWidth();
|
||||
} else {
|
||||
offsetx = 5;
|
||||
}
|
||||
}
|
||||
|
||||
super.overlayRecipe(gui, recipe, recipeIndex, shift);
|
||||
return super.transferRecipe(gui, handler, recipeIndex, multiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMoveFrom(Slot slot, GuiContainer gui) {
|
||||
if (gui.inventorySlots instanceof CraftingStationContainer) {
|
||||
CraftingStationLogic logic = ((CraftingStationContainer) gui.inventorySlots).logic;
|
||||
if (gui.inventorySlots instanceof CraftingStationContainer stationContainer) {
|
||||
CraftingStationLogic logic = stationContainer.logic;
|
||||
if (logic.chest != null && slot.inventory == logic.chest.get()) return true;
|
||||
if (logic.doubleChest != null && slot.inventory == logic.doubleChest.get()) return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user