Merge pull request #181 from KAMKEEL/codex/fix-item-duplication-on-pre-event-cancel

Fix recipe pre-event duplication bug
This commit is contained in:
Kam authored and GitHub committed 2025-07-09 16:42:43 -04:00
commit bb0f63e44c
2 files changed
+4 -2

No files matched your search

@@ -282,6 +282,7 @@ public class ContainerAnvilRepair extends Container {
canPickup = !EventHooks.onRecipeScriptPre(player, recipe.getScriptHandler(), recipe, items);
if (!canPickup) {
container.updateRepairResult();
preChecked = false; // reset for next attempt
}
} else {
canPickup = true;
@@ -147,8 +147,8 @@ public class ContainerCarpentryBench extends Container {
}
// Update client-side inventory
if (!this.worldObj.isRemote && player instanceof EntityPlayerMP) {
((EntityPlayerMP) player).sendContainerToPlayer(this);
if (!this.worldObj.isRemote && par1EntityPlayer instanceof EntityPlayerMP) {
((EntityPlayerMP) par1EntityPlayer).sendContainerToPlayer(this);
}
return var2;
@@ -183,6 +183,7 @@ public class ContainerCarpentryBench extends Container {
canPickup = !EventHooks.onRecipeScriptPre(player, recipe.getScriptHandler(), recipe, items);
if (!canPickup) {
container.onCraftMatrixChanged(matrix);
preChecked = false; // reset for next attempt
}
} else {
canPickup = true;