1.14.4 Problème Entité



  • Mon problème est que quand je fais spawner mon entité, ça me fait spawner un cochon mais qui a les mêmes propriétés que mon entité, pourtant j'ai bien tout fait comme il fallait pour les renders etc.

    Voici mon code :

    Classe de l'entité

    public class TopazeZombieEntity extends CreatureEntity {
    
        @SuppressWarnings("unchecked")
        public TopazeZombieEntity(EntityType<? extends CreatureEntity> type, World world) {
            super((EntityType<? extends CreatureEntity>) ModEntities.TOPAZE_ZOMBIE, world);
        }
    
        @Override
        protected void registerGoals() {
            this.goalSelector.addGoal(0, new SwimGoal(this));
            this.goalSelector.addGoal(1, new RandomWalkingGoal(this, 1.2d));
            this.goalSelector.addGoal(2, new LookRandomlyGoal(this));
        }
    
        @Override
        protected void registerAttributes() {
            super.registerAttributes();
            this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(30.0d);
            this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(1.0d);
        }
    
    }
    

    Classe Register Etc :

    public class ModEntities {
    
        public static ModEntities INSTANCE = new ModEntities();
    
        public static EntityType<?> TOPAZE_ZOMBIE = EntityType.Builder.create(TopazeZombieEntity::new, EntityClassification.CREATURE).build(References.MODID + ":topaze_zombie").setRegistryName("topaze_zombie");
    
        public static void registerEntitySpawnEggs(RegistryEvent.Register<Item> event){
            event.getRegistry().registerAll(
                ModItems.zombie_topaze_egg = registerEntitySpawnEgg(TOPAZE_ZOMBIE, 0x99CAF6, 0x194976, "topaze_zombie_egg")
            );
        }
    
        public static void registerEntityWorldSpawns(){
            registerEntityWorldSpawn(TOPAZE_ZOMBIE, Biomes.PLAINS, Biomes.BEACH, Biomes.JUNGLE);
        }
    
        public static Item registerEntitySpawnEgg(EntityType<?> type, int color1, int color2, String name){
            SpawnEggItem item = new SpawnEggItem(type, color1, color2, new Item.Properties().group(MyMod.myModTab));
            item.setRegistryName(name);
            return item;
        }
    
        public static void registerEntityWorldSpawn(EntityType<?> entity, Biome... biomes){
            for (Biome biome : biomes){
                if (biome != null){
                    biome.getSpawns(entity.getClassification()).add(new Biome.SpawnListEntry(entity, 10, 1, 3));
                }
            }
        }
    
        @SubscribeEvent
        public static void registerEntities(RegistryEvent.Register<EntityType<?>> event){
            event.getRegistry().registerAll(
                    TOPAZE_ZOMBIE
            );
            registerEntityWorldSpawns();
        }
    
    }
    

    Classe de mon render :

    @OnlyIn(Dist.CLIENT)
    public class TopazeZombieRender extends LivingRenderer<TopazeZombieEntity, TopazeZombieEntityModel> {
    
        public TopazeZombieRender(EntityRendererManager manager) {
            super(manager, new TopazeZombieEntityModel(), 0f);
        }
    
        @Override
        protected ResourceLocation getEntityTexture(TopazeZombieEntity topazeZombieEntity) {
            return new ResourceLocation("textures/entity/topaze_zombie.png");
        }
    
        public static class RenderFactory implements IRenderFactory<TopazeZombieEntity>{
    
            @Override
            public EntityRenderer<? super TopazeZombieEntity> createRenderFor(EntityRendererManager manager) {
                return new TopazeZombieRender(manager);
            }
        }
    }
    

    Classe du model : (normal si c'est extends de CowModel, j'ai pas encore fait le model)

    @OnlyIn(Dist.CLIENT)
    public class TopazeZombieEntityModel extends CowModel<TopazeZombieEntity> {
    
    }
    

    Classe de register du render :

    @OnlyIn(Dist.CLIENT)
    public class MyModRenderRegistry {
    
        public static void registerEntityRenders(){
            RenderingRegistry.registerEntityRenderingHandler(TopazeZombieEntity.class, new TopazeZombieRender.RenderFactory());
        }
    
    }
    

    Et ma classe principale :

    @Mod(References.MODID)
    public class MyMod {
    
        public static final Logger logger = Logger.getLogger(References.MODID);
    
        public static final ItemGroup myModTab = new MyModTab();
    
        public MyMod(){
            FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
            FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
    
            MinecraftForge.EVENT_BUS.register(ModItems.INSTANCE);
            MinecraftForge.EVENT_BUS.register(ModBlocks.INSTANCE);
            MinecraftForge.EVENT_BUS.register(ModEntities.INSTANCE);
        }
    
        private void setup(FMLCommonSetupEvent event){
            logger.info("Mod Setup Loading !");
            OreGeneration.setupGeneration();
        }
    
        private void clientSetup(FMLClientSetupEvent event){
            MyModRenderRegistry.registerEntityRenders();
            logger.info("Mod Client Setup Loading !");
        }
    
    }
    

Log in to reply