Не получается сделать моба с моделью Enderman

101
3
Не получается сделать моба с внешностью (моделью) ванильного Enderman.
Мой код рендера модели:
Код:
package ru.ipv2007.AMobs;

import net.minecraft.client.model.ModelEnderman;
import net.minecraft.client.renderer.entity.RenderEnderman;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RenderAMobs011 extends RenderEnderman {
    
    private static final ResourceLocation textureLocation = new ResourceLocation("amobs:textures/models/amobs011.png");
            
    public RenderAMobs011(ModelEnderman model, float shadowSize)
    {
    super();
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity par1Entity) {
    return textureLocation;
    }

}

ClientProxy
Код:
RenderingRegistry.registerEntityRenderingHandler(AMobs011.class, new RenderAMobs011(new ModelEnderman(), 0.5F));

Покажите ошибку?

При запуске клиента выдает такую ошибку:

java.lang.ClassCastException: ru.ipv2007.AMobs.AMobs011 cannot be cast to net.minecraft.entity.monster.EntityEnderman


Спасибо.
 
Dragon2488 написал(а):
Нет, просто модель эндермена для эндермена.
А как правильно сделать?
[merge_posts_bbcode]Добавлено: 20.03.2016 18:22:11[/merge_posts_bbcode]

Вот так?
Код:
package ru.ipv2007.AMobs;

import net.minecraft.client.model.ModelEnderman;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RenderAMobs013 extends RenderBiped {
    
    private static final ResourceLocation textureLocation = new ResourceLocation("amobs:textures/models/amobs010.png");
            
    public RenderAMobs013(ModelEnderman model, float shadowSize)
    {
    super(model, shadowSize);
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity par1Entity) {
    return textureLocation;
    }

}

[merge_posts_bbcode]Добавлено: 20.03.2016 18:24:25[/merge_posts_bbcode]

Ага, все получилось. Спасибо. ;)

[merge_posts_bbcode]Добавлено: 20.03.2016 18:38:06[/merge_posts_bbcode]

Теперь у меня новая проблема с IronGolem. Выше описанный способ не получается сделать с IronGolem.
Там есть какая-то особенность?
 
AlexSocol написал(а):
Просто экстеньдь то, что нужно, а модель можно любую брать
В том-то и дело, что при таком способе Eclipse ругается на параметр super ();
Что в нем надо написать? Какие значения?
Если взять модель IronGolem вот так:
Код:
public RenderAMobs013(ModelIronGolem model, float shadowSize)
    {
    super(model, shadowSize);
    }

Eclipse ругается на super (); и автоматом предлагает заменить модель на Biped.
При этом экстендс такой: 
Код:
extends RenderBiped

Что не так делаю?
 
Не получиться унаследовать по нормально от RenderEnderman, так как этот рендер настроен для моба EntityEnderman. Возможно, придётся скопировать из RenderEnderman для своего рендера, и что связанного, в скопированном коде, заменить с EntityEnderman на свой Entity.
[merge_posts_bbcode]Добавлено: 21.03.2016 20:30:14[/merge_posts_bbcode]

* для моба EntityEnderman и его наследникам.
 
ipv2007 написал(а):
AlexSocol написал(а):
Просто экстеньдь то, что нужно
Код:
extends RenderBiped
Что не так делаю?
Аргх! Чувак! Логично! Если ты экстендишь рендер игрока, то и модель игрока будет! Где ты видел человека в теле слона?

Кароче, не насилуй себе мозг, пиши "extends RenderLiving" и модель "ModelBase" и всё будет чики-пуки :D
[merge_posts_bbcode]Добавлено: 22.03.2016 23:31:36[/merge_posts_bbcode]

Всеми нами любимый и уважаемый дракон однажды кинул простой и гениальный код:
Dragon2488 написал(а):
Код:
import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class MobRender extends RenderLiving { private static final ResourceLocation Your_Texture = new ResourceLocation(ModID, "textures/entity/Mob.png"); public MobRender(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } @Override protected ResourceLocation getEntityTexture(Entity par1Entity) { return Your_Texture; } }

[merge_posts_bbcode]Добавлено: 22.03.2016 23:32:32[/merge_posts_bbcode]

При копировании слегка помялся, но ctrl+shift+f всегда спасёт :D
 
Ни черта не получается. Только тень видно и ошибка рендера. Вот мой код, что опять упустил?
Код:
package ru.ipv2007.AMobs;

import net.minecraft.client.model.ModelIronGolem;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RenderAMobs013 extends RenderLiving {
    
    private static final ResourceLocation textureLocation = new ResourceLocation("amobs:textures/models/amobs013.png");
            
    public RenderAMobs013(ModelIronGolem model, float shadowSize)
    {
    super(model, shadowSize);
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity par1Entity) {
    return textureLocation;
    }

}
 
Ну я же дал грёбаный пример!
"ModelIronGolem model" -> "ModelBase model" !
Попоболь тебе сделаю, если опять накосячишь
 
Взял код ентити рендера и модели от эндера

Переписал названия Enderman ---- MyEnderman 

во всех трех файлах поправил ссылки твой код 

зарегал в клиенте рендер ентити и модель 

и в главном добавил регу яйца на призыв только что попробовал на Големе работает

По поводу тени рендер смотрит в ванильного моба а не в твоего в итоге он нефига не понимает и если почитать лог наверняка будет что то типа 

Код:
java.lang.ClassCastException: net.minecraft.src.MODID.mobs.ТВОЙENDERMAN cannot be cast to net.minecraft.entity.monster.EntityEnderman
 
Потом пукан прожжет стул ченить поменять и опять тут новая тема будет так сразу замутил и спи спокойно

Я вот ковырялся с Datawatcher невкурил как там сделать чтобы больше скинов было у мобов х_х
И со своим измерением тоже не але
 
АлексСокол, как бы модели эндермена требуется энтитя эндермена. Предупреждение.
 
С каких это пор и как тогда я обошёлся без этого?
[merge_posts_bbcode]Добавлено: 25.03.2016 16:06:22[/merge_posts_bbcode]

Убирай своё предупреждение, ничего такого моделе не нужно -_- Кодеру нужны лишь руки из нужного места

Регистарция моба:
Код:
EntityList.addMapping(TestMobEnder.class, "Ender-Shmender", 110, 0x00000, 0x000000);

Рендера:
Код:
RenderingRegistry.registerEntityRenderingHandler(TestMobEnder.class, new RenderEnderMob(new ModelEnderman(), 1.0F));

Моб:
Код:
public class TestMobEnder extends EntityMob {

    @Override
    protected void applyEntityAttributes() {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D);
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(2.0D);
        this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(100.0D);
    }

    public TestMobEnder(World world) {
        super(world);
    }
}

И сам рендер:
Код:
public class RenderEnderMob extends RenderLiving {
    private static final ResourceLocation Your_Texture = new ResourceLocation(ModInfo.MODID, "textures/entity/FireBall.png"); //Потому что Фаерболлы - это круто

    public RenderEnderMob(ModelBase par1ModelBase, float par2) {
        super(par1ModelBase, par2);
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity par1Entity) {
        return Your_Texture;
    }
}

И вуаля, готов моб с моделькой эндермена!
oRQnwgP.png

Текстура такая, потому что FireBall
 
Мой эндермэн:
Код:
public class RenderEvolvedEnderman extends RenderLiving
{
 private static final ResourceLocation endermanEyesTexture = new ResourceLocation(GalaxySpace.ASSET_PREFIX + ":" + "textures/model/enderman_gs_eyes.png");
 private static final ResourceLocation endermanTextures = new ResourceLocation(GalaxySpace.ASSET_PREFIX + ":" + "textures/model/enderman_gs.png");

 private ModelEvolvedEnderman endermanModel;
 private Random rnd = new Random();

 public RenderEvolvedEnderman()
 {
 super(new ModelEvolvedEnderman(), 0.5F);
 this.endermanModel = (ModelEvolvedEnderman)super.mainModel;
 this.setRenderPassModel(this.endermanModel);
 }

 public void doRender(EntityEvolvedEnderman p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
 {
 this.endermanModel.isCarrying = p_76986_1_.getCarried().getMaterial() != Material.air;
 this.endermanModel.isAttacking = p_76986_1_.isScreaming();

 if (p_76986_1_.isScreaming())
 {
 double var10 = 0.02D;
 p_76986_2_ += this.rnd.nextGaussian() * var10;
 p_76986_6_ += this.rnd.nextGaussian() * var10;
 }
 super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
 }

 protected ResourceLocation getEntityTexture(EntityEvolvedEnderman p_110775_1_)
 {
 return endermanTextures;
 }

 protected void renderEquippedItems(EntityEvolvedEnderman p_77029_1_, float p_77029_2_)
 {
 super.renderEquippedItems(p_77029_1_, p_77029_2_);

 if (p_77029_1_.getCarried().getMaterial() != Material.air)
 {
 GL11.glEnable(GL12.GL_RESCALE_NORMAL);
 GL11.glPushMatrix();
 float var3 = 0.5F;
 GL11.glTranslatef(0.0F, 0.6875F, -0.75F);
 var3 *= 1.0F;
 GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
 GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
 GL11.glScalef(-var3, -var3, var3);
 int var4 = p_77029_1_.getBrightnessForRender(p_77029_2_);
 int var5 = var4 % 65536;
 int var6 = var4 / 65536;
 OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var5 / 1.0F, var6 / 1.0F);
 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
 this.bindTexture(TextureMap.locationBlocksTexture);
 this.field_147909_c.renderBlockAsItem(p_77029_1_.getCarried(), p_77029_1_.getCarryingData(), 1.0F);
 GL11.glPopMatrix();
 GL11.glDisable(GL12.GL_RESCALE_NORMAL);
 }
 }

 protected int shouldRenderPass(EntityEvolvedEnderman p_77032_1_, int p_77032_2_, float p_77032_3_)
 {
 if (p_77032_2_ != 0)
 {
 return -1;
 }
 else
 {
 this.bindTexture(endermanEyesTexture);
 float var4 = 1.0F;
 GL11.glEnable(GL11.GL_BLEND);
 GL11.glDisable(GL11.GL_ALPHA_TEST);
 GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
 GL11.glDisable(GL11.GL_LIGHTING);

 if (p_77032_1_.isInvisible())
 {
 GL11.glDepthMask(false);
 }
 else
 {
 GL11.glDepthMask(true);
 }
 OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
 GL11.glEnable(GL11.GL_LIGHTING);
 GL11.glColor4f(1.0F, 1.0F, 1.0F, var4);
 return 1;
 }
 }

 @Override
 public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
 {
 this.doRender((EntityEvolvedEnderman)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
 }

 @Override
 protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_)
 {
 return this.shouldRenderPass((EntityEvolvedEnderman)p_77032_1_, p_77032_2_, p_77032_3_);
 }

 @Override
 protected void renderEquippedItems(EntityLivingBase p_77029_1_, float p_77029_2_)
 {
 this.renderEquippedItems((EntityEvolvedEnderman)p_77029_1_, p_77029_2_);
 }

 @Override
 public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
 {
 this.doRender((EntityEvolvedEnderman)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
 }

 @Override
 protected ResourceLocation getEntityTexture(Entity p_110775_1_)
 {
 return this.getEntityTexture((EntityEvolvedEnderman)p_110775_1_);
 }

 @Override
 public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
 {
 this.doRender((EntityEvolvedEnderman)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
 }
Знаю, былокод. Но мне лень править код.
YFUTUrwmw3k.jpg
 
Но вот железный голем хочет энтитю себя... короче, чел, не парься и возьми из techne/tabula нужные модели :D
а то пишем тут обходы или лазейки ищем, когда можно намного проще
 
AlexSocol написал(а):
Но вот железный голем хочет энтитю себя... короче, чел, не парься и возьми из techne/tabula нужные модели :D
а то пишем тут обходы или лазейки ищем, когда можно намного проще
Так, модель Эндермена у меня не вызывает проблем. Эндермен у меня уже давно прекрасно бегает.
Я спрашиваю о моделе IronGolem! ;)
 
ipv2007 написал(а):
AlexSocol написал(а):
Но вот железный голем хочет энтитю себя... короче, чел, не парься и возьми из techne/tabula нужные модели :D
а то пишем тут обходы или лазейки ищем, когда можно намного проще
Так, модель Эндермена у меня не вызывает проблем. Эндермен у меня уже давно прекрасно бегает.
Я спрашиваю о моделе IronGolem! ;)
Код:
@SideOnly(Side.CLIENT)
public class ModelIronGolem extends ModelBase
{
    /** The head model for the iron golem. */
    public ModelRenderer ironGolemHead;
    /** The body model for the iron golem. */
    public ModelRenderer ironGolemBody;
    /** The right arm model for the iron golem. */
    public ModelRenderer ironGolemRightArm;
    /** The left arm model for the iron golem. */
    public ModelRenderer ironGolemLeftArm;
    /** The left leg model for the Iron Golem. */
    public ModelRenderer ironGolemLeftLeg;
    /** The right leg model for the Iron Golem. */
    public ModelRenderer ironGolemRightLeg;
    private static final String __OBFID = "CL_00000863";

    public ModelIronGolem()
    {
        this(0.0F);
    }

    public ModelIronGolem(float p_i1161_1_)
    {
        this(p_i1161_1_, -7.0F);
    }

    public ModelIronGolem(float p_i1162_1_, float p_i1162_2_)
    {
        short short1 = 128;
        short short2 = 128;
        this.ironGolemHead = (new ModelRenderer(this)).setTextureSize(short1, short2);
        this.ironGolemHead.setRotationPoint(0.0F, 0.0F + p_i1162_2_, -2.0F);
        this.ironGolemHead.setTextureOffset(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, p_i1162_1_);
        this.ironGolemHead.setTextureOffset(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, p_i1162_1_);
        this.ironGolemBody = (new ModelRenderer(this)).setTextureSize(short1, short2);
        this.ironGolemBody.setRotationPoint(0.0F, 0.0F + p_i1162_2_, 0.0F);
        this.ironGolemBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, p_i1162_1_);
        this.ironGolemBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, p_i1162_1_ + 0.5F);
        this.ironGolemRightArm = (new ModelRenderer(this)).setTextureSize(short1, short2);
        this.ironGolemRightArm.setRotationPoint(0.0F, -7.0F, 0.0F);
        this.ironGolemRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, p_i1162_1_);
        this.ironGolemLeftArm = (new ModelRenderer(this)).setTextureSize(short1, short2);
        this.ironGolemLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F);
        this.ironGolemLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, p_i1162_1_);
        this.ironGolemLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);
        this.ironGolemLeftLeg.setRotationPoint(-4.0F, 18.0F + p_i1162_2_, 0.0F);
        this.ironGolemLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, p_i1162_1_);
        this.ironGolemRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);
        this.ironGolemRightLeg.mirror = true;
        this.ironGolemRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + p_i1162_2_, 0.0F);
        this.ironGolemRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, p_i1162_1_);
    }

    /**
     * Sets the models various rotation angles then renders the model.
     */
    public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_)
    {
        this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_);
        this.ironGolemHead.render(p_78088_7_);
        this.ironGolemBody.render(p_78088_7_);
        this.ironGolemLeftLeg.render(p_78088_7_);
        this.ironGolemRightLeg.render(p_78088_7_);
        this.ironGolemRightArm.render(p_78088_7_);
        this.ironGolemLeftArm.render(p_78088_7_);
    }

    /**
     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
     * "far" arms and legs can swing at most.
     */
    public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_)
    {
        this.ironGolemHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
        this.ironGolemHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
        this.ironGolemLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(p_78087_1_, 13.0F) * p_78087_2_;
        this.ironGolemRightLeg.rotateAngleX = 1.5F * this.func_78172_a(p_78087_1_, 13.0F) * p_78087_2_;
        this.ironGolemLeftLeg.rotateAngleY = 0.0F;
        this.ironGolemRightLeg.rotateAngleY = 0.0F;
    }

    /**
     * Used for easily adding entity-dependent animations. The second and third float params here are the same second
     * and third as in the setRotationAngles method.
     */
    public void setLivingAnimations(EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_)
    {
        EntityIronGolem entityirongolem = (EntityIronGolem)p_78086_1_;
        int i = entityirongolem.getAttackTimer();

        if (i > 0)
        {
            this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - p_78086_4_, 10.0F);
            this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - p_78086_4_, 10.0F);
        }
        else
        {
            int j = entityirongolem.getHoldRoseTick();

            if (j > 0)
            {
                this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a((float)j, 70.0F);
                this.ironGolemLeftArm.rotateAngleX = 0.0F;
            }
            else
            {
                this.ironGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_;
                this.ironGolemLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_;
            }
        }
    }

    private float func_78172_a(float p_78172_1_, float p_78172_2_)
    {
        return (Math.abs(p_78172_1_ % p_78172_2_ - p_78172_2_ * 0.5F) - p_78172_2_ * 0.25F) / (p_78172_2_ * 0.25F);
    }
}

EntityIronGolem -> На свой Entity.
 
Назад
Сверху