mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-28 11:29:17 +00:00
feat(network): 完善客户端侧物品数据处理
This commit is contained in:
@@ -92,8 +92,8 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
|
||||
instance = this;
|
||||
S2C_BYTE_BUFFER_PACKET_HANDLERS = new BiConsumer[PacketIdFinder.maxS2CPacketId() + 1];
|
||||
C2S_BYTE_BUFFER_PACKET_HANDLERS = new BiConsumer[PacketIdFinder.maxC2SPacketId() + 1];
|
||||
Arrays.fill(S2C_BYTE_BUFFER_PACKET_HANDLERS, (BiConsumer<NetWorkUser, ByteBufPacketEvent>) (user, event) -> {});
|
||||
Arrays.fill(C2S_BYTE_BUFFER_PACKET_HANDLERS, (BiConsumer<NetWorkUser, ByteBufPacketEvent>) (user, event) -> {});
|
||||
Arrays.fill(S2C_BYTE_BUFFER_PACKET_HANDLERS, Handlers.DO_NOTHING);
|
||||
Arrays.fill(C2S_BYTE_BUFFER_PACKET_HANDLERS, Handlers.DO_NOTHING);
|
||||
hasModelEngine = Bukkit.getPluginManager().getPlugin("ModelEngine") != null;
|
||||
hasViaVersion = Bukkit.getPluginManager().getPlugin("ViaVersion") != null;
|
||||
this.plugin = plugin;
|
||||
@@ -710,4 +710,14 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Handlers extends BiConsumer<NetWorkUser, ByteBufPacketEvent> {
|
||||
Handlers DO_NOTHING = doNothing();
|
||||
|
||||
static Handlers doNothing() {
|
||||
return (user, byteBufPacketEvent) -> {
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,15 +73,15 @@ import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class PacketConsumers {
|
||||
private static AddEntityHandler[] ADD_ENTITY_HANDLERS;
|
||||
private static BukkitNetworkManager.Handlers[] ADD_ENTITY_HANDLERS;
|
||||
private static int[] mappings;
|
||||
private static int[] mappingsMOD;
|
||||
private static IntIdentityList BLOCK_LIST;
|
||||
private static IntIdentityList BIOME_LIST;
|
||||
|
||||
public static void initEntities(int registrySize) {
|
||||
ADD_ENTITY_HANDLERS = new AddEntityHandler[registrySize];
|
||||
Arrays.fill(ADD_ENTITY_HANDLERS, AddEntityHandler.DO_NOTHING);
|
||||
ADD_ENTITY_HANDLERS = new BukkitNetworkManager.Handlers[registrySize];
|
||||
Arrays.fill(ADD_ENTITY_HANDLERS, BukkitNetworkManager.Handlers.DO_NOTHING);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$FALLING_BLOCK$registryId] = (user, event) -> {
|
||||
FriendlyByteBuf buf = event.getBuffer();
|
||||
int id = buf.readVarInt();
|
||||
@@ -121,6 +121,21 @@ public class PacketConsumers {
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$BLOCK_DISPLAY$registryId] = simpleAddEntityHandler(BlockDisplayPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$TEXT_DISPLAY$registryId] = simpleAddEntityHandler(TextDisplayPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$ARMOR_STAND$registryId] = simpleAddEntityHandler(ArmorStandPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$ITEM_DISPLAY$registryId] = simpleAddEntityHandler(ItemDisplayPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$FIREBALL$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$EYE_OF_ENDER$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$FIREWORK_ROCKET$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$ITEM$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$ITEM_FRAME$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$SMALL_FIREBALL$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$EGG$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$ENDER_PEARL$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$EXPERIENCE_BOTTLE$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$SNOWBALL$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$POTION$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
if (VersionHelper.isOrAbove1_20_5()) {
|
||||
ADD_ENTITY_HANDLERS[Reflections.instance$EntityType$OMINOUS_ITEM_SPAWNER$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initBlocks(Map<Integer, Integer> map, int registrySize) {
|
||||
@@ -2271,17 +2286,7 @@ public class PacketConsumers {
|
||||
}
|
||||
};
|
||||
|
||||
@FunctionalInterface
|
||||
public interface AddEntityHandler extends BiConsumer<NetWorkUser, ByteBufPacketEvent> {
|
||||
AddEntityHandler DO_NOTHING = doNothing();
|
||||
|
||||
static AddEntityHandler doNothing() {
|
||||
return (user, byteBufPacketEvent) -> {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static AddEntityHandler simpleAddEntityHandler(EntityPacketHandler handler) {
|
||||
private static BukkitNetworkManager.Handlers simpleAddEntityHandler(EntityPacketHandler handler) {
|
||||
return (user, event) -> {
|
||||
FriendlyByteBuf buf = event.getBuffer();
|
||||
user.entityPacketHandlers().put(buf.readVarInt(), handler);
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package net.momirealms.craftengine.bukkit.plugin.network.handler;
|
||||
|
||||
import net.momirealms.craftengine.bukkit.item.BukkitItemManager;
|
||||
import net.momirealms.craftengine.bukkit.nms.FastNMS;
|
||||
import net.momirealms.craftengine.bukkit.plugin.user.BukkitServerPlayer;
|
||||
import net.momirealms.craftengine.bukkit.util.EntityDataUtils;
|
||||
import net.momirealms.craftengine.core.item.ItemBuildContext;
|
||||
import net.momirealms.craftengine.core.plugin.network.ByteBufPacketEvent;
|
||||
import net.momirealms.craftengine.core.plugin.network.EntityPacketHandler;
|
||||
import net.momirealms.craftengine.core.plugin.network.NetWorkUser;
|
||||
import net.momirealms.craftengine.core.util.FriendlyByteBuf;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class CommonItemPacketHandler implements EntityPacketHandler {
|
||||
public static final CommonItemPacketHandler INSTANCE = new CommonItemPacketHandler();
|
||||
|
||||
@Override
|
||||
public void handleSetEntityData(NetWorkUser user, ByteBufPacketEvent event) {
|
||||
FriendlyByteBuf buf = event.getBuffer();
|
||||
ItemBuildContext context = ItemBuildContext.of((BukkitServerPlayer) user);
|
||||
int id = buf.readVarInt();
|
||||
boolean isChanged = false;
|
||||
List<Object> packedItems = FastNMS.INSTANCE.method$ClientboundSetEntityDataPacket$unpack(buf);
|
||||
for (int i = 0; i < packedItems.size(); i++) {
|
||||
Object packedItem = packedItems.get(i);
|
||||
int entityDataId = FastNMS.INSTANCE.field$SynchedEntityData$DataValue$id(packedItem);
|
||||
if (entityDataId == EntityDataUtils.ITEM_DATA_ID) {
|
||||
Object nmsItemStack = FastNMS.INSTANCE.field$SynchedEntityData$DataValue$value(packedItem);
|
||||
ItemStack itemStack = FastNMS.INSTANCE.method$CraftItemStack$asCraftMirror(nmsItemStack);
|
||||
Optional<ItemStack> optional = BukkitItemManager.instance().s2c(itemStack, context);
|
||||
if (optional.isPresent()) {
|
||||
isChanged = true;
|
||||
itemStack = optional.get();
|
||||
Object serializer = FastNMS.INSTANCE.field$SynchedEntityData$DataValue$serializer(packedItem);
|
||||
packedItems.set(i, FastNMS.INSTANCE.constructor$SynchedEntityData$DataValue(
|
||||
entityDataId, serializer, FastNMS.INSTANCE.method$CraftItemStack$asNMSCopy(itemStack)
|
||||
));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isChanged) {
|
||||
event.setChanged(true);
|
||||
buf.clear();
|
||||
buf.writeVarInt(event.packetID());
|
||||
buf.writeVarInt(id);
|
||||
FastNMS.INSTANCE.method$ClientboundSetEntityDataPacket$pack(packedItems, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package net.momirealms.craftengine.bukkit.plugin.network.handler;
|
||||
|
||||
import net.momirealms.craftengine.bukkit.item.BukkitItemManager;
|
||||
import net.momirealms.craftengine.bukkit.nms.FastNMS;
|
||||
import net.momirealms.craftengine.bukkit.plugin.user.BukkitServerPlayer;
|
||||
import net.momirealms.craftengine.bukkit.util.EntityDataUtils;
|
||||
import net.momirealms.craftengine.core.item.ItemBuildContext;
|
||||
import net.momirealms.craftengine.core.plugin.network.ByteBufPacketEvent;
|
||||
import net.momirealms.craftengine.core.plugin.network.EntityPacketHandler;
|
||||
import net.momirealms.craftengine.core.plugin.network.NetWorkUser;
|
||||
import net.momirealms.craftengine.core.util.FriendlyByteBuf;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ItemDisplayPacketHandler implements EntityPacketHandler {
|
||||
public static final ItemDisplayPacketHandler INSTANCE = new ItemDisplayPacketHandler();
|
||||
|
||||
@Override
|
||||
public void handleSetEntityData(NetWorkUser user, ByteBufPacketEvent event) {
|
||||
FriendlyByteBuf buf = event.getBuffer();
|
||||
ItemBuildContext context = ItemBuildContext.of((BukkitServerPlayer) user);
|
||||
int id = buf.readVarInt();
|
||||
boolean isChanged = false;
|
||||
List<Object> packedItems = FastNMS.INSTANCE.method$ClientboundSetEntityDataPacket$unpack(buf);
|
||||
for (int i = 0; i < packedItems.size(); i++) {
|
||||
Object packedItem = packedItems.get(i);
|
||||
int entityDataId = FastNMS.INSTANCE.field$SynchedEntityData$DataValue$id(packedItem);
|
||||
if (entityDataId == EntityDataUtils.DISPLAYED_ITEM_DATA_ID) {
|
||||
Object nmsItemStack = FastNMS.INSTANCE.field$SynchedEntityData$DataValue$value(packedItem);
|
||||
ItemStack itemStack = FastNMS.INSTANCE.method$CraftItemStack$asCraftMirror(nmsItemStack);
|
||||
Optional<ItemStack> optional = BukkitItemManager.instance().s2c(itemStack, context);
|
||||
if (optional.isPresent()) {
|
||||
isChanged = true;
|
||||
itemStack = optional.get();
|
||||
Object serializer = FastNMS.INSTANCE.field$SynchedEntityData$DataValue$serializer(packedItem);
|
||||
packedItems.set(i, FastNMS.INSTANCE.constructor$SynchedEntityData$DataValue(
|
||||
entityDataId, serializer, FastNMS.INSTANCE.method$CraftItemStack$asNMSCopy(itemStack)
|
||||
));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isChanged) {
|
||||
event.setChanged(true);
|
||||
buf.clear();
|
||||
buf.writeVarInt(event.packetID());
|
||||
buf.writeVarInt(id);
|
||||
FastNMS.INSTANCE.method$ClientboundSetEntityDataPacket$pack(packedItems, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,9 @@ public class EntityDataUtils {
|
||||
private static final int RIGHT_ALIGNMENT = 0x10; // 16
|
||||
public static final int BLOCK_STATE_DATA_ID = VersionHelper.isOrAbove1_20_2() ? 23 : 22;
|
||||
public static final int TEXT_DATA_ID = VersionHelper.isOrAbove1_20_2() ? 23 : 22;
|
||||
public static final int DISPLAYED_ITEM_DATA_ID = VersionHelper.isOrAbove1_20_2() ? 23 : 22;
|
||||
public static final int CUSTOM_NAME_DATA_ID = 2;
|
||||
public static final int ITEM_DATA_ID = 8;
|
||||
|
||||
public static byte encodeTextDisplayMask(boolean hasShadow, boolean isSeeThrough, boolean useDefaultBackground, int alignment) {
|
||||
int bitMask = 0;
|
||||
|
||||
@@ -3846,6 +3846,17 @@ public class Reflections {
|
||||
public static final Object instance$EntityType$OAK_BOAT;
|
||||
public static final Object instance$EntityType$TRIDENT;
|
||||
public static final Object instance$EntityType$SNOWBALL;
|
||||
public static final Object instance$EntityType$FIREBALL;
|
||||
public static final Object instance$EntityType$EYE_OF_ENDER;
|
||||
public static final Object instance$EntityType$FIREWORK_ROCKET;
|
||||
public static final Object instance$EntityType$ITEM;
|
||||
public static final Object instance$EntityType$ITEM_FRAME;
|
||||
public static final Object instance$EntityType$OMINOUS_ITEM_SPAWNER;
|
||||
public static final Object instance$EntityType$SMALL_FIREBALL;
|
||||
public static final Object instance$EntityType$EGG;
|
||||
public static final Object instance$EntityType$ENDER_PEARL;
|
||||
public static final Object instance$EntityType$EXPERIENCE_BOTTLE;
|
||||
public static final Object instance$EntityType$POTION;
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -3869,6 +3880,32 @@ public class Reflections {
|
||||
instance$EntityType$TRIDENT = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, trident);
|
||||
Object snowball = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "snowball");
|
||||
instance$EntityType$SNOWBALL = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, snowball);
|
||||
Object fireball = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "fireball");
|
||||
instance$EntityType$FIREBALL = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, fireball);
|
||||
Object eyeOfEnder = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "eye_of_ender");
|
||||
instance$EntityType$EYE_OF_ENDER = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, eyeOfEnder);
|
||||
Object fireworkRocket = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "firework_rocket");
|
||||
instance$EntityType$FIREWORK_ROCKET = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, fireworkRocket);
|
||||
Object item = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "item");
|
||||
instance$EntityType$ITEM = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, item);
|
||||
Object itemFrame = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "item_frame");
|
||||
instance$EntityType$ITEM_FRAME = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, itemFrame);
|
||||
Object smallFireball = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "small_fireball");
|
||||
instance$EntityType$SMALL_FIREBALL = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, smallFireball);
|
||||
Object egg = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "egg");
|
||||
instance$EntityType$EGG = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, egg);
|
||||
Object enderPearl = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "ender_pearl");
|
||||
instance$EntityType$ENDER_PEARL = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, enderPearl);
|
||||
Object experienceBottle = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "experience_bottle");
|
||||
instance$EntityType$EXPERIENCE_BOTTLE = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, experienceBottle);
|
||||
Object potion = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "potion");
|
||||
instance$EntityType$POTION = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, potion);
|
||||
if (VersionHelper.isOrAbove1_20_5()) {
|
||||
Object ominousItemSpawner = FastNMS.INSTANCE.method$ResourceLocation$fromNamespaceAndPath("minecraft", "ominous_item_spawner");
|
||||
instance$EntityType$OMINOUS_ITEM_SPAWNER = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, ominousItemSpawner);
|
||||
} else {
|
||||
instance$EntityType$OMINOUS_ITEM_SPAWNER = null;
|
||||
}
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -6451,6 +6488,18 @@ public class Reflections {
|
||||
public static final int instance$EntityType$FALLING_BLOCK$registryId;
|
||||
public static final int instance$EntityType$TRIDENT$registryId;
|
||||
public static final int instance$EntityType$ARMOR_STAND$registryId;
|
||||
public static final int instance$EntityType$FIREBALL$registryId;
|
||||
public static final int instance$EntityType$EYE_OF_ENDER$registryId;
|
||||
public static final int instance$EntityType$FIREWORK_ROCKET$registryId;
|
||||
public static final int instance$EntityType$ITEM$registryId;
|
||||
public static final int instance$EntityType$ITEM_FRAME$registryId;
|
||||
public static final int instance$EntityType$OMINOUS_ITEM_SPAWNER$registryId;
|
||||
public static final int instance$EntityType$SMALL_FIREBALL$registryId;
|
||||
public static final int instance$EntityType$EGG$registryId;
|
||||
public static final int instance$EntityType$ENDER_PEARL$registryId;
|
||||
public static final int instance$EntityType$EXPERIENCE_BOTTLE$registryId;
|
||||
public static final int instance$EntityType$SNOWBALL$registryId;
|
||||
public static final int instance$EntityType$POTION$registryId;
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -6460,6 +6509,22 @@ public class Reflections {
|
||||
instance$EntityType$FALLING_BLOCK$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$FALLING_BLOCK);
|
||||
instance$EntityType$TRIDENT$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$TRIDENT);
|
||||
instance$EntityType$ARMOR_STAND$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$ARMOR_STAND);
|
||||
instance$EntityType$FIREBALL$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$FIREBALL);
|
||||
instance$EntityType$EYE_OF_ENDER$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$EYE_OF_ENDER);
|
||||
instance$EntityType$FIREWORK_ROCKET$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$FIREWORK_ROCKET);
|
||||
instance$EntityType$ITEM$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$ITEM);
|
||||
instance$EntityType$ITEM_FRAME$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$ITEM_FRAME);
|
||||
instance$EntityType$SMALL_FIREBALL$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$SMALL_FIREBALL);
|
||||
instance$EntityType$EGG$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$EGG);
|
||||
instance$EntityType$ENDER_PEARL$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$ENDER_PEARL);
|
||||
instance$EntityType$EXPERIENCE_BOTTLE$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$EXPERIENCE_BOTTLE);
|
||||
instance$EntityType$SNOWBALL$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$SNOWBALL);
|
||||
instance$EntityType$POTION$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$POTION);
|
||||
if (VersionHelper.isOrAbove1_20_5()) {
|
||||
instance$EntityType$OMINOUS_ITEM_SPAWNER$registryId = (int) Reflections.method$Registry$getId.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, instance$EntityType$OMINOUS_ITEM_SPAWNER);
|
||||
} else {
|
||||
instance$EntityType$OMINOUS_ITEM_SPAWNER$registryId = -1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user