Solved Custom entity invisible after spawn 1.12.2

Discussion in 'Spigot Plugin Development' started by CuongVnZ, May 14, 2019.

  1. Hi there,
    I just created a custom entity class
    I register that entity by using the code below:
    Code (Java):
        public static void registerEntities() {

            for (EntityRegistrar entity : values()) {
                a(entity.getCustomClass(), entity.getName(), entity.getID());
                /*EntityTypes.b.a(, entity.key, entity.getCustomClass());
                if (!EntityTypes.d.contains(entity.key)) {


            BiomeBase[] biomes;
            try {
                biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
            } catch (Exception exc) {
                // Unable to fetch.
            for (BiomeBase biomeBase : biomes) {
                if (biomeBase == null)

                for (String field : new String[] { "t", "u", "v", "w" })
                    try {
                        Field list = BiomeBase.class.getDeclaredField(field);
                        List<BiomeMeta> mobList = (List<BiomeMeta>) list.get(biomeBase);

                        for (BiomeMeta meta : mobList)
                            for (EntityRegistrar entity : values())
                                if (entity.getNMSClass().equals(meta.b))
                                    meta.b = entity.getCustomClass();
                    } catch (Exception e) {
        private static void a(Class<?> paramClass, String paramString, int paramInt) {
            try {
                ((Map<String, Class<?>>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
                ((Map<Class<?>, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
                ((Map<Integer, Class<?>>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
                ((Map<Class<?>, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
                ((Map<String, Integer>) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
            } catch (Exception exc) {
                // Unable to register the new class.

    The console run fine, no error, but entity after spawned was invisible, i just heard their sound.
    Please help me
  2. ho do you solved it?