diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java index 343127328..89387aa3b 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java @@ -1099,9 +1099,9 @@ public class NMSImpl implements NMSBridge { public void registerEntityClass(Class clazz, Object raw) { if (ENTITY_REGISTRY == null) return; - EntityTypes type = (EntityTypes) raw; Class search = clazz; while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) { + EntityTypes type = ENTITY_REGISTRY.findType(search); MinecraftKey key = ENTITY_REGISTRY.getKey(type); if (key == null) { continue; diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MobEntityController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MobEntityController.java index 51e34a4de..9f7b1bca5 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MobEntityController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MobEntityController.java @@ -25,7 +25,7 @@ import net.minecraft.server.v1_14_R1.World; public abstract class MobEntityController extends AbstractEntityController { private final Class clazz; -protected MobEntityController(Class clazz) {NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz)); +protected MobEntityController(Class clazz) {NMS.registerEntityClass(clazz, null); this.clazz = clazz; } diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java index 1ec859862..895125ef6 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java @@ -1142,9 +1142,9 @@ public class NMSImpl implements NMSBridge { public void registerEntityClass(Class clazz, Object raw) { if (ENTITY_REGISTRY == null) return; - EntityTypes type = (EntityTypes) raw; Class search = clazz; while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) { + EntityTypes type = ENTITY_REGISTRY.findType(search); MinecraftKey key = ENTITY_REGISTRY.getKey(type); if (key == null || type == null) { continue; diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MobEntityController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MobEntityController.java index 4545025b5..647c3f0e9 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MobEntityController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MobEntityController.java @@ -25,7 +25,7 @@ import net.minecraft.server.v1_15_R1.World; public abstract class MobEntityController extends AbstractEntityController { private final Class clazz; -protected MobEntityController(Class clazz) {NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz)); +protected MobEntityController(Class clazz) {NMS.registerEntityClass(clazz, null); this.clazz = clazz; } diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java index 06f4da842..ec4d34ef0 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java @@ -1159,9 +1159,9 @@ public class NMSImpl implements NMSBridge { public void registerEntityClass(Class clazz, Object raw) { if (ENTITY_REGISTRY == null) return; - EntityTypes type = (EntityTypes) raw; Class search = clazz; while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) { + net.minecraft.server.v1_15_R1.EntityTypes type = ENTITY_REGISTRY.findType(search); MinecraftKey key = ENTITY_REGISTRY.getKey(type); if (key == null || type == null) { continue; diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MobEntityController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MobEntityController.java index 287534043..5cf931730 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MobEntityController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MobEntityController.java @@ -25,7 +25,7 @@ import net.minecraft.server.v1_16_R3.World; public abstract class MobEntityController extends AbstractEntityController { private final Class clazz; -protected MobEntityController(Class clazz) {NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz)); +protected MobEntityController(Class clazz) {NMS.registerEntityClass(clazz, null); this.clazz = clazz; } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java index 192e6df43..4f3bbffc6 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java @@ -1182,9 +1182,9 @@ public class NMSImpl implements NMSBridge { public void registerEntityClass(Class clazz, Object raw) { if (ENTITY_REGISTRY == null) return; - EntityTypes type = (EntityTypes) raw; Class search = clazz; while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) { + net.minecraft.server.v1_16_R3.EntityTypes type = ENTITY_REGISTRY.findType(search); MinecraftKey key = ENTITY_REGISTRY.getKey(type); if (key == null || type == null) { continue; diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/MobEntityController.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/MobEntityController.java index 0dbe5ce39..140de073e 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/MobEntityController.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/MobEntityController.java @@ -25,7 +25,7 @@ public abstract class MobEntityController extends AbstractEntityController { private final Class clazz; protected MobEntityController(Class clazz) { - NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz)); + NMS.registerEntityClass(clazz, null); this.clazz = clazz; } diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java index 4849932a3..4925d3bf4 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java @@ -1188,9 +1188,9 @@ public class NMSImpl implements NMSBridge { public void registerEntityClass(Class clazz, Object raw) { if (ENTITY_REGISTRY == null) return; - net.minecraft.world.entity.EntityType type = (net.minecraft.world.entity.EntityType) raw; Class search = clazz; while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) { + net.minecraft.world.entity.EntityType type = ENTITY_REGISTRY.findType(search); ResourceLocation key = ENTITY_REGISTRY.getKey(type); if (key == null || type == null) { continue; diff --git a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/entity/MobEntityController.java b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/entity/MobEntityController.java index ed718b19d..1b19aa5ae 100644 --- a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/entity/MobEntityController.java +++ b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/entity/MobEntityController.java @@ -25,7 +25,7 @@ public abstract class MobEntityController extends AbstractEntityController { private final Class clazz; protected MobEntityController(Class clazz) { - NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz)); + NMS.registerEntityClass(clazz, null); this.clazz = clazz; } diff --git a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java index 61cd0d47c..ed29dcb59 100644 --- a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java +++ b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java @@ -1197,9 +1197,9 @@ public class NMSImpl implements NMSBridge { public void registerEntityClass(Class clazz, Object raw) { if (ENTITY_REGISTRY == null) return; - net.minecraft.world.entity.EntityType type = (net.minecraft.world.entity.EntityType) raw; Class search = clazz; while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) { + net.minecraft.world.entity.EntityType type = ENTITY_REGISTRY.findType(search); ResourceLocation key = ENTITY_REGISTRY.getKey(type); if (key == null || type == null) { continue; diff --git a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/entity/MobEntityController.java b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/entity/MobEntityController.java index 38e814614..6ddba2d58 100644 --- a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/entity/MobEntityController.java +++ b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/entity/MobEntityController.java @@ -25,7 +25,7 @@ public abstract class MobEntityController extends AbstractEntityController { private final Class clazz; protected MobEntityController(Class clazz) { - NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz)); + NMS.registerEntityClass(clazz, null); this.clazz = clazz; } diff --git a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java index 632c8b2d2..5bdebd271 100644 --- a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java +++ b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java @@ -1336,9 +1336,9 @@ public class NMSImpl implements NMSBridge { public void registerEntityClass(Class clazz, Object raw) { if (ENTITY_REGISTRY == null) return; - net.minecraft.world.entity.EntityType type = (net.minecraft.world.entity.EntityType) raw; Class search = clazz; while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) { + net.minecraft.world.entity.EntityType type = ENTITY_REGISTRY.findType(search); ResourceLocation key = ENTITY_REGISTRY.getKey(type); if (key == null || type == null) { continue; diff --git a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/MobEntityController.java b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/MobEntityController.java index 58ce91e37..c8a078cbe 100644 --- a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/MobEntityController.java +++ b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/MobEntityController.java @@ -25,15 +25,14 @@ public abstract class MobEntityController extends AbstractEntityController { private final Class clazz; protected MobEntityController(Class clazz) { - NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz)); + NMS.registerEntityClass(clazz, null); this.clazz = clazz; } @Override protected Entity createEntity(Location at, NPC npc) { - EntityType type = NMSImpl.getEntityType(clazz); - net.minecraft.world.entity.Entity entity = createEntityFromClass(type, ((CraftWorld) at.getWorld()).getHandle(), - npc); + net.minecraft.world.entity.Entity entity = createEntityFromClass(NMSImpl.getEntityType(clazz), + ((CraftWorld) at.getWorld()).getHandle(), npc); if (entity instanceof Mob) { NMSImpl.clearGoals(npc, ((Mob) entity).goalSelector, ((Mob) entity).targetSelector); Mob mob = (Mob) entity; diff --git a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/util/NMSImpl.java b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/util/NMSImpl.java index 368c373c7..f997cb503 100644 --- a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/util/NMSImpl.java +++ b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/util/NMSImpl.java @@ -1001,7 +1001,6 @@ public class NMSImpl implements NMSBridge { } private void loadEntityTypes() { - EntityControllers.setEntityControllerForType(EntityType.ALLAY, AllayController.class); EntityControllers.setEntityControllerForType(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloudController.class); EntityControllers.setEntityControllerForType(EntityType.ARMADILLO, ArmadilloController.class); @@ -1368,9 +1367,9 @@ public class NMSImpl implements NMSBridge { public void registerEntityClass(Class clazz, Object raw) { if (ENTITY_REGISTRY == null) return; - net.minecraft.world.entity.EntityType type = (net.minecraft.world.entity.EntityType) raw; Class search = clazz; while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) { + net.minecraft.world.entity.EntityType type = ENTITY_REGISTRY.findType(search); ResourceLocation key = ENTITY_REGISTRY.getKey(type); if (key == null || type == null) continue;