Skip to content

Commit

Permalink
Fix voiding when shift clicking item in wand whilst inventory is full (
Browse files Browse the repository at this point in the history
…#16)

* update bs + deps

* make this code readable

* fix voiding when shift clicking item in wand whilst inventory is full
  • Loading branch information
Lyfts authored Mar 1, 2024
1 parent fb06e02 commit 706a1ab
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies {
implementation('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.23:dev')
implementation('com.github.GTNewHorizons:VisualProspecting:1.2.1:dev')
implementation('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.79:dev')
implementation('com.github.GTNewHorizons:VisualProspecting:1.2.10:dev')
}
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ channel = stable
mappingsVersion = 12

# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
Expand Down Expand Up @@ -61,6 +61,9 @@ gradleTokenModId = GRADLETOKEN_MODID
# [DEPRECATED] Mod name replacement token.
gradleTokenModName = GRADLETOKEN_MODNAME

# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName = GRADLETOKEN_GROUPNAME

# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
Expand Down Expand Up @@ -123,7 +126,7 @@ includeWellKnownRepositories = true
usesMavenPublishing = true

# Maven repository to publish the mod to.
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/

# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
Expand Down Expand Up @@ -187,5 +190,3 @@ disableCheckstyle = true
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

# Non-GTNH properties
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.15'
}


23 changes: 12 additions & 11 deletions src/main/java/com/encraft/dz/container/ContainerBuildingKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,25 @@ public ItemStack transferStackInSlot(EntityPlayer player, int par2) {
((Slot) this.inventorySlots.get(par2)).putStack(toMove);
} else {
boolean canMerge = false;
ItemStack toMove = ((SlotItemInv) this.inventorySlots.get(0)).getStack();
SlotItemInv fromSlot = (SlotItemInv) this.inventorySlots.get(0);
ItemStack toMove = fromSlot.getStack();
if (toMove == null) return null;
for (int i = 1; i < this.inventorySlots.size(); i++) {
if ((GT_Utility.areStacksEqual(
((SlotItemInv) this.inventorySlots.get(0)).getStack(),
((Slot) this.inventorySlots.get(i)).getStack())
&& ((Slot) this.inventorySlots.get(i)).getStack().stackSize
< ((Slot) this.inventorySlots.get(i)).getStack().getMaxStackSize())) {
((Slot) this.inventorySlots.get(i)).getStack().stackSize++;
((SlotItemInv) this.inventorySlots.get(0)).putStack(null);
Slot toSlot = (Slot) this.inventorySlots.get(i);
ItemStack toPlace = toSlot.getStack();

if (GT_Utility.areStacksEqual(toMove, toPlace) && toPlace.stackSize < toPlace.getMaxStackSize()) {
toPlace.stackSize++;
fromSlot.putStack(null);
canMerge = true;
break;
}
}
for (int i = 1; i < this.inventorySlots.size(); i++) {
if (!canMerge && (!((Slot) this.inventorySlots.get(i)).getHasStack())) {
((SlotItemInv) this.inventorySlots.get(0)).putStack(null);
((Slot) this.inventorySlots.get(i)).putStack(toMove);
Slot toSlot = ((Slot) this.inventorySlots.get(i));
if (!canMerge && toSlot.getStack() == null) {
fromSlot.putStack(null);
toSlot.putStack(toMove);
break;
}
}
Expand Down

0 comments on commit 706a1ab

Please sign in to comment.