From 109beda4c51ae236ab6b74dfaab1c682aca9eb6c Mon Sep 17 00:00:00 2001 From: fullwall Date: Thu, 3 Sep 2020 00:08:23 +0800 Subject: [PATCH] Fix missing piglin brute type --- .../nms/v1_16_R2/util/CustomEntityRegistry.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/v1_16_R2/src/main/java/net/citizensnpcs/nms/v1_16_R2/util/CustomEntityRegistry.java b/v1_16_R2/src/main/java/net/citizensnpcs/nms/v1_16_R2/util/CustomEntityRegistry.java index 96f6620db..402402f32 100644 --- a/v1_16_R2/src/main/java/net/citizensnpcs/nms/v1_16_R2/util/CustomEntityRegistry.java +++ b/v1_16_R2/src/main/java/net/citizensnpcs/nms/v1_16_R2/util/CustomEntityRegistry.java @@ -24,7 +24,8 @@ public class CustomEntityRegistry extends RegistryBlocks { @SuppressWarnings("unchecked") public CustomEntityRegistry(RegistryBlocks> original) throws Throwable { - super(original.a().getNamespace(), (ResourceKey>>) IREGISTRY_RESOURCE_KEY.invoke(original), + super(original.a().getNamespace(), + (ResourceKey>>) IREGISTRY_RESOURCE_KEY.invoke(original), (Lifecycle) IREGISTRY_LIFECYCLE.invoke(original)); this.wrapped = original; } @@ -106,11 +107,11 @@ public class CustomEntityRegistry extends RegistryBlocks { entityIds.put(entityClass, entityId); } + private static final MethodHandle IREGISTRY_LIFECYCLE = NMS.getGetter(IRegistry.class, "bf"); // replace regex // ([A-Z_]+).*?a\(E(.*?)::new.*?$ // minecraftClassMap.put(EntityTypes.\1, E\2.class); private static final MethodHandle IREGISTRY_RESOURCE_KEY = NMS.getGetter(IRegistry.class, "b"); - private static final MethodHandle IREGISTRY_LIFECYCLE = NMS.getGetter(IRegistry.class, "bf"); private static final BiMap> minecraftClassMap = HashBiMap.create(); static { minecraftClassMap.put(EntityTypes.AREA_EFFECT_CLOUD, EntityAreaEffectCloud.class); @@ -174,6 +175,7 @@ public class CustomEntityRegistry extends RegistryBlocks { minecraftClassMap.put(EntityTypes.PHANTOM, EntityPhantom.class); minecraftClassMap.put(EntityTypes.PIG, EntityPig.class); minecraftClassMap.put(EntityTypes.PIGLIN, EntityPiglin.class); + minecraftClassMap.put(EntityTypes.PIGLIN_BRUTE, EntityPiglinBrute.class); minecraftClassMap.put(EntityTypes.PILLAGER, EntityPillager.class); minecraftClassMap.put(EntityTypes.POLAR_BEAR, EntityPolarBear.class); minecraftClassMap.put(EntityTypes.TNT, EntityTNTPrimed.class);