diff --git a/build.gradle b/build.gradle index 67d13e8e..5e787403 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1646409286 +//version: 1650343995 /* DO NOT CHANGE THIS FILE! @@ -187,9 +187,9 @@ try { } catch (Exception ignored) { out.style(Style.Failure).text( - 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + - 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + - 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' + 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + + 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' ) versionOverride = 'NO-GIT-TAG-SET' identifiedVersion = versionOverride @@ -216,13 +216,13 @@ def jvmArguments = [] if (usesMixins.toBoolean()) { arguments += [ - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] if (usesMixinDebug.toBoolean()) { jvmArguments += [ - "-Dmixin.debug.countInjections=true", - "-Dmixin.debug.verbose=true", - "-Dmixin.debug.export=true" + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" ] } } @@ -431,9 +431,9 @@ processResources { // replace modVersion and minecraftVersion expand "minecraftVersion": project.minecraft.version, - "modVersion": modVersion, - "modId": modId, - "modName": modName + "modVersion": modVersion, + "modId": modId, + "modName": modName } if(usesMixins.toBoolean()) { @@ -568,7 +568,7 @@ publishing { artifact source: shadowJar, classifier: "" } if(!noPublishedSources) { - artifact source: sourcesJar, classifier: "src" + artifact source: sourcesJar, classifier: "sources" } artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" if (apiPackage) { diff --git a/dependencies.gradle b/dependencies.gradle index 714294b8..715f549f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -3,10 +3,10 @@ dependencies { compile("com.github.GTNewHorizons:Mantle:0.3.4:dev") compile("com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev") - compile("com.github.GTNewHorizons:NotEnoughItems:2.2.3-GTNH:dev") - compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.2:dev") + compile("com.github.GTNewHorizons:NotEnoughItems:2.2.12-GTNH:dev") + compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev") compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.5.13:api") - compileOnly("com.github.GTNewHorizons:waila:1.5.18:api") + compileOnly("com.github.GTNewHorizons:waila:1.5.20:api") compileOnly("com.github.GTNewHorizons:Battlegear2:master-SNAPSHOT:api") { transitive = false } diff --git a/src/main/java/tconstruct/tools/gui/ChestSlot.java b/src/main/java/tconstruct/tools/gui/ChestSlot.java index 4212bbcc..eec0abc7 100644 --- a/src/main/java/tconstruct/tools/gui/ChestSlot.java +++ b/src/main/java/tconstruct/tools/gui/ChestSlot.java @@ -2,31 +2,59 @@ package tconstruct.tools.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; public class ChestSlot extends Slot { /* * A Slot, used for adjacent Chest Inventories, that can be disabled. */ public boolean enabled = true; - - public ChestSlot(IInventory inventory, int index, int xPosition, int yPosition) { + private int accessSide; + private int visualIndex; + + public ChestSlot(IInventory inventory, int index, int visualIndex, int xPosition, int yPosition, int accessSide) { super(inventory, index, xPosition, yPosition); + this.accessSide = accessSide; + this.visualIndex = visualIndex; } - + @SideOnly(Side.CLIENT) @Override public boolean func_111238_b/*isEnabled*/() { return enabled; } - + + public int getVisualIndex() { + return visualIndex; + } + public void disable() { enabled = false; } - + public void enable() { enabled = true; } + @Override + public boolean isItemValid(ItemStack itemStack) { + if (inventory instanceof ISidedInventory) { + ISidedInventory sided = (ISidedInventory) inventory; + return sided.canInsertItem(this.getSlotIndex(), itemStack, accessSide); + } + return inventory.isItemValidForSlot(this.getSlotIndex(), itemStack); + } + + @Override + public boolean canTakeStack(EntityPlayer player) { + if (inventory instanceof ISidedInventory) { + ISidedInventory sided = (ISidedInventory) inventory; + return sided.canExtractItem(this.getSlotIndex(), this.getStack(), accessSide); + } + return super.canTakeStack(player); + } } diff --git a/src/main/java/tconstruct/tools/gui/CraftingStationGui.java b/src/main/java/tconstruct/tools/gui/CraftingStationGui.java index f35ca9b6..b0a776ca 100644 --- a/src/main/java/tconstruct/tools/gui/CraftingStationGui.java +++ b/src/main/java/tconstruct/tools/gui/CraftingStationGui.java @@ -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; diff --git a/src/main/java/tconstruct/tools/inventory/CraftingStationContainer.java b/src/main/java/tconstruct/tools/inventory/CraftingStationContainer.java index 9beae996..a06029b2 100644 --- a/src/main/java/tconstruct/tools/inventory/CraftingStationContainer.java +++ b/src/main/java/tconstruct/tools/inventory/CraftingStationContainer.java @@ -92,7 +92,8 @@ public class CraftingStationContainer extends Container { IInventory inv = logic.getFirstInventory(); IInventory secondInv = logic.getSecondInventory(); - final Set accessibleSlots = inv instanceof ISidedInventory ? new HashSet<>(Ints.asList(((ISidedInventory) inv).getAccessibleSlotsFromSide(logic.chestDirection.getOpposite().ordinal()))) : null; + final int accessSide = logic.chestDirection.getOpposite().ordinal(); + final int[] accessibleSlots = inv instanceof ISidedInventory ? ((ISidedInventory) inv).getAccessibleSlotsFromSide(accessSide) : null; int index = 0, curIndex = 0; IInventory curInv; @@ -104,10 +105,16 @@ public class CraftingStationContainer extends Container { curInv = secondInv != null && index >= 27 ? secondInv : inv; // Adjust the index for the inventory curIndex = secondInv != null && index >= 27 ? index - 27 : index; - - if(accessibleSlots == null || accessibleSlots.contains(curIndex)) { - this.addSlotToContainer(new ChestSlot(curInv, curIndex, 8 + col * 18, 19 + row * 18)); + + if(accessibleSlots != null) { + if (curIndex >= accessibleSlots.length) { + break; + } else { + curIndex = accessibleSlots[curIndex]; + } } + + this.addSlotToContainer(new ChestSlot(curInv, curIndex, index, 8 + col * 18, 19 + row * 18, accessSide)); index++; } }