Skip to content

Commit

Permalink
Merge pull request #31 from HaHaWTH/ver/1.20.4
Browse files Browse the repository at this point in the history
Fix MC-2025 and MC-65198
  • Loading branch information
Dreeam-qwq authored Mar 12, 2024
2 parents 9f73b0b + b22aed1 commit dd5e91a
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
41 changes: 41 additions & 0 deletions patches/server/0075-Fix-MC-2025.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <[email protected]>
Date: Wed, 13 Mar 2024 03:04:36 +0800
Subject: [PATCH] Fix-MC-2025


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f9b0c49423ec9a66389f9f0e93e57ef7714cbe08..f709c926f4f5eb6a46ed1c80dc64153da897838e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2566,6 +2566,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Paper end
nbttagcompound.put("Leaves.Data", leavesData); // Leaves - leaves ex data
+
+ // Leaf start - Fix MC-2025
+ AABB boundingBox = getBoundingBox();
+ ListTag boundingBoxList = new ListTag();
+ for (double coord : new double[]{boundingBox.minX, boundingBox.minY, boundingBox.minZ, boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ}) {
+ boundingBoxList.add(DoubleTag.valueOf(coord));
+ }
+ nbttagcompound.put("Leaf.BoundingBox", boundingBoxList);
+ // Leaf end
+
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2643,6 +2653,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.reapplyPosition();
}

+ // Leaf start - Fix MC-2025
+ if (nbt.contains("Leaf.BoundingBox", net.minecraft.nbt.Tag.TAG_LIST)) {
+ ListTag boundingBoxList = nbt.getList("Leaf.BoundingBox", net.minecraft.nbt.Tag.TAG_DOUBLE);
+ setBoundingBox(new AABB(boundingBoxList.getDouble(0), boundingBoxList.getDouble(1), boundingBoxList.getDouble(2), boundingBoxList.getDouble(3), boundingBoxList.getDouble(4), boundingBoxList.getDouble(5)));
+ }
+ // Leaf end
+
} else {
throw new IllegalStateException("Entity has invalid rotation");
}
61 changes: 61 additions & 0 deletions patches/server/0076-Fix-MC-65198.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <[email protected]>
Date: Wed, 13 Mar 2024 03:33:08 +0800
Subject: [PATCH] Fix-MC-65198


diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
index 3756de835ea87e3a4fb87cbf77365ffd87957ea9..66e149fe132191293b6075f3368192f7007b143d 100644
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
@@ -141,6 +141,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
ItemStack itemstack1 = slot1.getItem();

itemstack = itemstack1.copy();
+ ItemStack itemStack2 = itemstack.copy(); // Leaf - Fix MC-65198
int j = this.getInventorySlotStart();
int k = this.getUseRowEnd();

@@ -179,7 +180,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
}

this.activeQuickItem = itemstack; // Purpur
- slot1.onTake(player, itemstack1);
+ slot1.onTake(player, itemStack2); // Leaf - Fix MC-65198
this.activeQuickItem = null; // Purpur
}

diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
index 245731757f2593c736916ac6ee59e2c91d179934..45995459a174bd62896fbd205a367a9945ec3bb2 100644
--- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java
+++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
@@ -45,7 +45,7 @@ public class ResultSlot extends Slot {
@Override
protected void checkTakeAchievements(ItemStack stack) {
if (this.removeCount > 0) {
- stack.onCraftedBy(this.player.level(), this.player, this.removeCount);
+ stack.onCraftedBy(this.player.level(), this.player, stack.getCount()); // Leaf - Fix MC-65198
}

Container var3 = this.container;
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index eade15820dd9db38b6af2a5c4314acfb14ca03e9..5fef8a6bc746a34a0b742c51f169a502bc9b6ce6 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -259,6 +259,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
Item item = itemstack1.getItem();

itemstack = itemstack1.copy();
+ ItemStack itemStack2 = itemstack.copy(); // Leaf - Fix MC-65198
if (slot == 1) {
item.onCraftedBy(itemstack1, player.level(), player);
if (!this.moveItemStackTo(itemstack1, 2, 38, true)) {
@@ -291,7 +292,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
return ItemStack.EMPTY;
}

- slot1.onTake(player, itemstack1);
+ slot1.onTake(player, itemStack2); // Leaf - Fix MC-65198
this.broadcastChanges();
}

0 comments on commit dd5e91a

Please sign in to comment.