Skip to content

Commit

Permalink
Fix GrindstoneEvent.OnPlaceItem patch (#1549)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryLoenwind authored Sep 20, 2024
1 parent 46112b3 commit 42023dc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
int l = 0;
l += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(0));
l += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(1));
@@ -131,6 +_,8 @@
@@ -125,6 +_,8 @@
}

private ItemStack computeResult(ItemStack p_332654_, ItemStack p_332736_) {
boolean flag = !p_332654_.isEmpty() || !p_332736_.isEmpty();
+ this.xp = net.neoforged.neoforge.common.CommonHooks.onGrindstoneChange(p_332654_, p_332736_, this.resultSlots, -1);
+ if (this.xp != Integer.MIN_VALUE) return ItemStack.EMPTY; // Porting 1.20.5 check if this is correct
if (!flag) {
return ItemStack.EMPTY;
} else if (p_332654_.getCount() <= 1 && p_332736_.getCount() <= 1) {
private void createResult() {
+ this.xp = net.neoforged.neoforge.common.CommonHooks.onGrindstoneChange(this.repairSlots.getItem(0), this.repairSlots.getItem(1), this.resultSlots, -1);
+ if (this.xp == Integer.MIN_VALUE)
this.resultSlots.setItem(0, this.computeResult(this.repairSlots.getItem(0), this.repairSlots.getItem(1)));
this.broadcastChanges();
}
@@ -155,7 +_,7 @@
int k = p_332686_.getMaxDamage() - p_332686_.getDamageValue();
int l = j + k + i * 5 / 100;
Expand Down

0 comments on commit 42023dc

Please sign in to comment.