From 81f0fc417af83e7ce83ef06472830855b3b29fd9 Mon Sep 17 00:00:00 2001
From: madi308 <77383233+madi308@users.noreply.github.com>
Date: Thu, 14 Mar 2024 17:31:49 +0200
Subject: [PATCH] Added 1.20.4 support
---
1_20_R3/pom.xml | 2 +-
.../versions/version_1_20_R3/NMSInterface_1_20_R3.java | 5 +++--
Plugin/pom.xml | 6 +++++-
.../java/net/seanomik/tamablefoxes/util/FieldHelper.java | 1 -
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/1_20_R3/pom.xml b/1_20_R3/pom.xml
index 128836c..f7f88de 100644
--- a/1_20_R3/pom.xml
+++ b/1_20_R3/pom.xml
@@ -78,7 +78,7 @@
net.wesjd
anvilgui
- 1.7.0-SNAPSHOT
+ 1.9.2-SNAPSHOT
diff --git a/1_20_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R3/NMSInterface_1_20_R3.java b/1_20_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R3/NMSInterface_1_20_R3.java
index 4e8c9dd..e1df2f3 100644
--- a/1_20_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R3/NMSInterface_1_20_R3.java
+++ b/1_20_R3/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R3/NMSInterface_1_20_R3.java
@@ -18,8 +18,9 @@ public class NMSInterface_1_20_R3 implements NMSInterface {
@Override
public void registerCustomFoxEntity() {
try { // Replace the fox entity
- Field field = EntityType.FOX.getClass().getDeclaredField("bz"); // bz = factory
- FieldHelper.setFieldUsingUnsafe(field, EntityType.FOX, (EntityType.EntityFactory) EntityTamableFox::new);
+ Field field = EntityType.FOX.getClass().getDeclaredField("bC"); // bC = factory
+ field.setAccessible(true);
+ field.set(EntityType.FOX, (EntityType.EntityFactory) EntityTamableFox::new);
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
} catch (Exception e) {
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
diff --git a/Plugin/pom.xml b/Plugin/pom.xml
index 2132280..4fc48e9 100644
--- a/Plugin/pom.xml
+++ b/Plugin/pom.xml
@@ -83,6 +83,10 @@
+
+ codemc-snapshots-anvilgui
+ https://repo.codemc.io/repository/maven-snapshots/
+
spigot-repo
https://hub.spigotmc.org/nexus/content/repositories/snapshots/
@@ -223,7 +227,7 @@
net.wesjd
anvilgui
- 1.7.0-SNAPSHOT
+ 1.9.2-SNAPSHOT
diff --git a/Utility/src/main/java/net/seanomik/tamablefoxes/util/FieldHelper.java b/Utility/src/main/java/net/seanomik/tamablefoxes/util/FieldHelper.java
index a8fd566..01b1b28 100644
--- a/Utility/src/main/java/net/seanomik/tamablefoxes/util/FieldHelper.java
+++ b/Utility/src/main/java/net/seanomik/tamablefoxes/util/FieldHelper.java
@@ -1,6 +1,5 @@
package net.seanomik.tamablefoxes.util;
-import org.bukkit.Bukkit;
import sun.misc.Unsafe;
import java.lang.reflect.Field;