Создание моба с уникальной моделью

Версия Minecraft
1.12.2
6
0
Решил создать моба с уникальной моделью. Но так как я совсем ничего не соображаю решил сначала попробовать по туториалам на сайте с моделью игрока. Вот вроде сделал все как описано, но моб выглядит как белый куб. Что я сделал не так? А еще подскажите, пожалуйста, как установить свою модель.
 
Решение
Видел одну тему с такой же проблемой вроде...
Держи ссылку
6
0
Java:
package com.example.examplemod;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackMelee;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;





public class Goblin extends EntityMob {

    

      public static int ADD_DAMAGE = 15;   
        public Goblin(World world) {

            super(world);

            setSize(0.6F, 1.98F);

        }



      

        public Goblin(World world, double x, double y, double z) {

            super(world);

        setSize(0.6F, 1.98F);

            setPositionAndUpdate(x, y, z);

        }



        @Override

        protected void applyEntityAttributes() {

          

            super.applyEntityAttributes();

          

            this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(35.0D);

            this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D);

            this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3.0D);

            this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(2.0D);

            this.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).setBaseValue(2.0D);

        }



        @Override

        protected void initEntityAI() {

          

            this.tasks.addTask(0, new EntityAISwimming(this));//Плавает ли моб

            this.tasks.addTask(1, new EntityAIAttackMelee(this, 1.0D, false));//Атака ближнего боя

            this.tasks.addTask(2, new EntityAIWander(this, 1.0D));//Моб путешествует

            this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));//Смотрит на EntityPlayer(игрок)

            this.tasks.addTask(4, new EntityAILookIdle(this));

            this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[]{EntityZombie.class, EntityPlayer.class}));

        }



        @Override

        public boolean attackEntityAsMob(Entity entityIn) {

        

            if (super.attackEntityAsMob(entityIn)) {//Проверка на атаку

                if (entityIn instanceof EntityLivingBase) {//Если это моб

                    ((EntityLivingBase) entityIn).attackEntityAsMob(this);//Делаем последним ударившим нашего моба

                    entityIn.attackEntityFrom(((EntityLivingBase) entityIn).getLastDamageSource(), rand.nextInt(ADD_DAMAGE));//Наносим доп. урон

                }

                return true;

            } else {

                return false;

            }

        }

        @Override

        public int getMaxSpawnedInChunk() {

            return 25;

        }

}
 
6
0
Java:
package com.example.examplemod;

import javax.annotation.Nonnull;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.IRenderFactory;



   
public class RenderGoblin extends RenderLiving<Goblin>
{
    private ResourceLocation mobTexture = new ResourceLocation(dndmod.MODID+ ":textures/entity/goblin.png");

   
    public RenderGoblin(RenderManager manager) {
        super(manager, new ModelBiped(), 0.5F);
    }
    public static Factory FACTORY = new Factory();
    @Override
    @Nonnull
    protected ResourceLocation getEntityTexture(@Nonnull Goblin entity) {
       
        return mobTexture;
    }

    public static class Factory implements IRenderFactory<Goblin> {
        @Override
        public Render<? super Goblin> createRenderFor(RenderManager manager) {
     
            return new RenderGoblin(manager);
        }
    }
 
    }
 
6
0
Регистрация:
package com.example.examplemod;

import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@Mod.EventBusSubscriber(modid = dndmod.MODID)
public class EntityRegistry {

    @SideOnly(Side.CLIENT)
    public static void initModels() {
        
        RenderingRegistry.registerEntityRenderingHandler(Goblin.class, RenderGoblin.FACTORY);
    }

    private static int ID = 0;
    public static EntityEntry GOBLIN = EntityEntryBuilder
            .create()
            .entity(Goblin.class)
            .name("Goblin")
            .id("goblin", ID++)
            .egg(0xff4040, 0xd891ef)
            .tracker(160, 2, false)
            .build();
    @SubscribeEvent
    public static void registryEntity(RegistryEvent.Register<EntityEntry> event) {
      
        event.getRegistry().registerAll(
                GOBLIN
        );
    }
}
 
32
1
7
Видел одну тему с такой же проблемой вроде...
Держи ссылку
 
3,005
192
592
Во 1 - можно больше, чем 1 код помещать в одно сообщение. И так же сообщения можно редактировать.

public static Factory FACTORY = new Factory();
Вот ты создал, а дальше ты куда-то ее заюзал?

Плюс есть поиск. Там можно найти решение твоей проблемы. Это "проблема" не такая ситуативная, что "ой ты такой индивидуальный, у других таких проблем не может быть".
 
3,005
192
592
Сверху