Make crafting stations slots use ISidedInventory/IInventory validation logic (#48)

* Update buildscript

* Update dependencies

* Make crafting stations slots use ISidedInventory/IInventory validation logic

* Fix handling of inventories with inaccessible slots
This commit is contained in:
Jakub Szewczyk authored and GitHub committed 2022-05-14 11:22:11 +02:00
1 parent 6ae7c13408
commit e9cacb5e37
5 files changed
+62 -28

No files matched your search

@@ -325,13 +325,12 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
public boolean shouldDrawSlot(Slot slot) {
if(!(slot instanceof ChestSlot)) return true;
if(slot.getSlotIndex() >= chestSlotCount) return false;
ChestSlot chestSlot = (ChestSlot) slot;
// all visible
if(!slider.isEnabled()) return true;
return firstSlotId <= slot.getSlotIndex() && lastSlotId > slot.getSlotIndex();
return firstSlotId <= chestSlot.getVisualIndex() && lastSlotId > chestSlot.getVisualIndex();
}
@Override
@@ -445,7 +444,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
if(shouldDrawSlot(slot)) {
slot.enable();
// calc position of the slot
final int offset = slot.getSlotIndex() + (slot.inventory == secondInventory ? 27 : 0) - firstSlotId;
final int offset = slot.getVisualIndex();
final int x = (offset % logic.invColumns) * CraftingStationGui.slotElement.w;
final int y = (offset / logic.invColumns) * CraftingStationGui.slotElement.h;