From 334b2f20dbdece82cd2e74ef007f7c12dbf7c0fa Mon Sep 17 00:00:00 2001 From: TonytheMacaroni Date: Sat, 25 Nov 2023 16:48:32 -0500 Subject: [PATCH] Fix max nearby entities class check (#9967) --- patches/server/0856-Fix-a-bunch-of-vanilla-bugs.patch | 11 +++++++---- ...3-Add-slot-sanity-checks-in-container-clicks.patch | 8 +++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/patches/server/0856-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0856-Fix-a-bunch-of-vanilla-bugs.patch index 6247c69382..370fc2a4a2 100644 --- a/patches/server/0856-Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/0856-Fix-a-bunch-of-vanilla-bugs.patch @@ -66,6 +66,9 @@ https://bugs.mojang.com/browse/MC-174630 https://bugs.mojang.com/browse/MC-153086 Fix the beacon deactivation sound always playing when broken +https://bugs.mojang.com/browse/MC-259321 + Fix spawners checking max nearby entities with correct type + == AT == public net/minecraft/world/entity/Mob leashInfoTag @@ -124,7 +127,7 @@ index b71be5e7e18f884cf35cc3a940c87e744e00f811..81d3d664d4397e528a02e50469622c4f return this.anyPlayerCloseEnoughForSpawning(pos, false); } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6b923585821a252943ea6a765c3b02217eb7a21e..008b0944dba1622e682ee21637273fb87f93dd37 100644 +index 1f1cdf5516eab738e5d434eb5f2933ff3d7a1359..c5f0439133f3ab609324f21f68027edebed049c5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1005,7 +1005,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -396,7 +399,7 @@ index ca6a2b9840c9ade87ec8effab01d4f184fe876b7..43129ecefcc8beccbcf2978f262b1ce8 stack.shrink(1); } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index ae2b95f53e875716489821dc9b0a3a35039bfcc9..9284c550ab2fe21331986a70eac414147662003d 100644 +index ae2b95f53e875716489821dc9b0a3a35039bfcc9..e4a5871d8f07e2b4c12b94b6372afe3a34b13071 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -46,6 +46,22 @@ public abstract class BaseSpawner { @@ -408,8 +411,8 @@ index ae2b95f53e875716489821dc9b0a3a35039bfcc9..9284c550ab2fe21331986a70eac41414 + return new net.minecraft.world.level.entity.EntityTypeTest<>() { + @Nullable + @Override -+ public T tryCast(B clazz) { -+ return (T)(clazz.equals(clazz.getClass()) ? clazz : null); ++ public T tryCast(B entity) { ++ return (T)(clazz.equals(entity.getClass()) ? entity : null); + } + + @Override diff --git a/patches/server/1013-Add-slot-sanity-checks-in-container-clicks.patch b/patches/server/1013-Add-slot-sanity-checks-in-container-clicks.patch index eb79d542ce..5aeb035c14 100644 --- a/patches/server/1013-Add-slot-sanity-checks-in-container-clicks.patch +++ b/patches/server/1013-Add-slot-sanity-checks-in-container-clicks.patch @@ -22,7 +22,7 @@ index 236ab643cdd65b3572860aedf1f5ac18ff96139a..65bb221993147a558995b36fb835f7b8 Slot clickedSlot = this.player.containerMenu.getSlot(packet.getSlotNum()); if (clickedSlot.mayPickup(this.player)) { diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..5d298b11f74cd2da47e6613ced621ab62aa73a7b 100644 +index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..aea228ea9fee51c25a03ce1c54bf9dff0741e053 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -423,6 +423,7 @@ public abstract class AbstractContainerMenu { @@ -33,10 +33,12 @@ index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..5d298b11f74cd2da47e6613ced621ab6 slot = (Slot) this.slots.get(slotIndex); itemstack = this.getCarried(); if (AbstractContainerMenu.canItemQuickReplace(slot, itemstack, true) && slot.mayPlace(itemstack) && (this.quickcraftType == 2 || itemstack.getCount() > this.quickcraftSlots.size()) && this.canDragTo(slot)) { -@@ -598,6 +599,7 @@ public abstract class AbstractContainerMenu { +@@ -597,7 +598,8 @@ public abstract class AbstractContainerMenu { + Slot slot2; int j2; - if (actionType == ClickType.SWAP) { +- if (actionType == ClickType.SWAP) { ++ if (actionType == ClickType.SWAP && (button == 40 || button >= 0 && button < 9)) { // Paper + if (slotIndex < 0 || button < 0) return; // Paper slot2 = (Slot) this.slots.get(slotIndex); itemstack1 = playerinventory.getItem(button);