Migrate reflections to mojang mapped by default

This commit is contained in:
Lixfel
2025-01-06 16:44:10 +01:00
parent 94a1ed3569
commit 9888700273
44 changed files with 216 additions and 110 deletions
@@ -42,16 +42,16 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
player.spigot().sendMessage(type, msg);
}
private static final Class<?> dataWatcherObject = Reflection.getClass("net.minecraft.network.syncher.DataWatcherObject");
private static final Class<?> dataWatcherRegistry = Reflection.getClass("net.minecraft.network.syncher.DataWatcherRegistry");
private static final Class<?> dataWatcherSerializer = Reflection.getClass("net.minecraft.network.syncher.DataWatcherSerializer");
private static final Class<?> dataWatcherObject = Reflection.getClass("net.minecraft.network.syncher.EntityDataAccessor");
private static final Class<?> dataWatcherRegistry = Reflection.getClass("net.minecraft.network.syncher.EntityDataSerializers");
private static final Class<?> dataWatcherSerializer = Reflection.getClass("net.minecraft.network.syncher.EntityDataSerializer");
private static final Reflection.Constructor dataWatcherObjectConstructor = Reflection.getConstructor(dataWatcherObject, int.class, dataWatcherSerializer);
@Override
public Object getDataWatcherObject(int index, Class<?> type) {
return dataWatcherObjectConstructor.invoke(index, Reflection.getField(dataWatcherRegistry, dataWatcherSerializer, 0, type).get(null));
}
private static final Class<?> item = Reflection.getClass("net.minecraft.network.syncher.DataWatcher$Item");
private static final Class<?> item = Reflection.getClass("net.minecraft.network.syncher.SynchedEntityData$DataItem");
private static final Reflection.Constructor itemConstructor = Reflection.getConstructor(item, dataWatcherObject, Object.class);
@Override
public Object getDataWatcherItem(Object dwo, Object value) {
@@ -25,7 +25,7 @@ import org.bukkit.entity.Player;
public class CraftbukkitWrapper9 implements CraftbukkitWrapper.ICraftbukkitWrapper {
private static final Class<?> chunk = Reflection.getClass("net.minecraft.world.level.chunk.Chunk");
private static final Class<?> chunk = Reflection.getClass("net.minecraft.world.level.chunk.LevelChunk");
private static final Class<?> packetPlayOutMapChunk = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutMapChunk");
private static final Reflection.Constructor newPacketPlayOutMapChunk = Reflection.getConstructor(packetPlayOutMapChunk, chunk, int.class);
private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle");
@@ -40,7 +40,7 @@ public class ChunkHider9 extends ChunkHider8 {
private static final Reflection.Field<List> mapChunkBlockEntities = Reflection.getField(mapChunkPacket, List.class, 0);
private static final Reflection.Field<byte[]> mapChunkData = Reflection.getField(mapChunkPacket, byte[].class, 0);
private static final Class<?> nbtTagCompound = Reflection.getClass("net.minecraft.nbt.NBTTagCompound");
private static final Class<?> nbtTagCompound = Reflection.getClass("net.minecraft.nbt.CompoundTag");
private static final Reflection.Method nbtTagGetString = Reflection.getTypedMethod(nbtTagCompound, null, String.class, String.class);
@Override