Added 1.20.4 support

This commit is contained in:
madi308 2024-03-14 17:31:49 +02:00
parent 3975898e59
commit 81f0fc417a
4 changed files with 9 additions and 5 deletions

View File

@ -78,7 +78,7 @@
<dependency> <dependency>
<groupId>net.wesjd</groupId> <groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId> <artifactId>anvilgui</artifactId>
<version>1.7.0-SNAPSHOT</version> <version>1.9.2-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -18,8 +18,9 @@ public class NMSInterface_1_20_R3 implements NMSInterface {
@Override @Override
public void registerCustomFoxEntity() { public void registerCustomFoxEntity() {
try { // Replace the fox entity try { // Replace the fox entity
Field field = EntityType.FOX.getClass().getDeclaredField("bz"); // bz = factory Field field = EntityType.FOX.getClass().getDeclaredField("bC"); // bC = factory
FieldHelper.setFieldUsingUnsafe(field, EntityType.FOX, (EntityType.EntityFactory<Fox>) EntityTamableFox::new); field.setAccessible(true);
field.set(EntityType.FOX, (EntityType.EntityFactory<Fox>) EntityTamableFox::new);
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced()); Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
} catch (Exception e) { } catch (Exception e) {
Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace()); Bukkit.getServer().getConsoleSender().sendMessage(Config.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());

View File

@ -83,6 +83,10 @@
</pluginRepositories> </pluginRepositories>
<repositories> <repositories>
<repository>
<id>codemc-snapshots-anvilgui</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@ -223,7 +227,7 @@
<dependency> <dependency>
<groupId>net.wesjd</groupId> <groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId> <artifactId>anvilgui</artifactId>
<version>1.7.0-SNAPSHOT</version> <version>1.9.2-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,6 +1,5 @@
package net.seanomik.tamablefoxes.util; package net.seanomik.tamablefoxes.util;
import org.bukkit.Bukkit;
import sun.misc.Unsafe; import sun.misc.Unsafe;
import java.lang.reflect.Field; import java.lang.reflect.Field;