From 30a5aa26cd692527f24b912cfacffbc9208a7b50 Mon Sep 17 00:00:00 2001 From: Jakl <57708725+Jakllp@users.noreply.github.com> Date: Mon, 9 Dec 2024 08:39:52 +0100 Subject: [PATCH] Fix #1698 #1697 #1696 --- .../compat/v1_21_R2/entity/EntityRegistry.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/v1_21_R2/src/main/java/de/Keyle/MyPet/compat/v1_21_R2/entity/EntityRegistry.java b/modules/v1_21_R2/src/main/java/de/Keyle/MyPet/compat/v1_21_R2/entity/EntityRegistry.java index 2ab129921..9c39f1b29 100644 --- a/modules/v1_21_R2/src/main/java/de/Keyle/MyPet/compat/v1_21_R2/entity/EntityRegistry.java +++ b/modules/v1_21_R2/src/main/java/de/Keyle/MyPet/compat/v1_21_R2/entity/EntityRegistry.java @@ -193,7 +193,21 @@ This means everything will be created properly in the beginning, will be handled //Post-Handle Vanilla Registry entityRegistry.freeze(); + /* Let me explain what's happening here: + Earlier we saved allTags. They contain stuff like special vulnerabilities to enchantments, + FallDamage-Resistance and in some instances (namely the Turtle) the ability for a Mob to + breath underwater. + Through the above code we reset those tags so we now have to do 2 things: + First re-add the Tags (that's why we saved them) + And then tell Minecraft to reload those values for them to actually take effect. + Gotta love MC */ ReflectionUtil.setFieldValue(allTagsField, entityRegistry, allTagsSaved); + Method refreshMethod = ReflectionUtil.getMethod(MappedRegistry.class, "u"); + try { + refreshMethod.invoke(entityRegistry); + } catch (Exception e) { + e.printStackTrace(); + } if(custReg != null) { //Gotta put the custom Registry back into place