From ed2ba0f52cab918f4a9aee66b4dfe1737e5d5f5f Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 21 Dec 2023 11:22:31 -0800 Subject: [PATCH] Cleanup Explosion patch but keep bin compatibility by using asm hacks. Closes #9817 --- .../minecraft/world/level/Explosion.java.patch | 17 ----------------- .../resources/coremods/add_bouncer_method.js | 4 +++- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/level/Explosion.java.patch b/patches/minecraft/net/minecraft/world/level/Explosion.java.patch index d675e5fba75..1a1ac0feb23 100644 --- a/patches/minecraft/net/minecraft/world/level/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Explosion.java.patch @@ -8,20 +8,3 @@ Vec3 vec3 = new Vec3(this.x, this.y, this.z); for(Entity entity : list) { -@@ -345,6 +_,16 @@ - - public List getToBlow() { - return this.toBlow; -+ } -+ -+ @Deprecated(forRemoval = true, since = "1.20.4") -+ public Vec3 getPosition() { -+ return this.center(); -+ } -+ -+ @Nullable -+ public Entity getExploder() { -+ return this.source; - } - - public Explosion.BlockInteraction getBlockInteraction() { diff --git a/src/main/resources/coremods/add_bouncer_method.js b/src/main/resources/coremods/add_bouncer_method.js index 5fdc228665c..6ecdd4c272c 100644 --- a/src/main/resources/coremods/add_bouncer_method.js +++ b/src/main/resources/coremods/add_bouncer_method.js @@ -7,7 +7,9 @@ var InsnNode = Java.type('org.objectweb.asm.tree.InsnNode') function initializeCoreMod() { return { - "getLanguage_bouncer": addBouncer("net.minecraft.network.play.client.CClientSettingsPacket", "func_149524_c", "getLanguage", "()Ljava/lang/String;"), + //TODO: Remove in 1.20.5+ + "getPosition_bouncer": addBouncer("net.minecraft.world.level.Explosion", "m_307721_", "getPosition", "()Lnet/minecraft/world/phys/Vec3;"), + "getExploder_bouncer": addBouncer("net.minecraft.world.level.Explosion", "m_253049_", "getExploder", "()Lnet/minecraft/world/entity/Entity;"), } }