надо чтобы когда моб движется изменялся угол наклона ног, но я больше чем уверен что здесь почти все неправильно
Java:
public class ModelSalamandra extends ModelBase
{
private static ResourceLocation tex = new ResourceLocation("devo", "textures/entity/salamandra.png");
private IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("devo", "obj/salamandra.obj"));
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
GL11.glPushMatrix();
GL11.glTranslatef(0.5F, 0.0F, 0.5F);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
Minecraft.getMinecraft().renderEngine.bindTexture(tex);
model.renderPart("body");
GL11.glPushMatrix();
float tranl = (0.75F / 40F) * Math.abs(tile.time - 40);
if(motion[X/Y/Z] > 0){ mot= true;
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, +tranl);
GL11.glRotatef(0.0F, 1.0F, 0.0F, 0.0F);
model.renderPart("leg1");
model.renderPart("leg2");
model.renderPart("leg3");
model.renderPart("leg4");
GL11.glPopMatrix();
GL11.glPopMatrix();
}
else mot=false;
}
}
Java:
public class salamandra extends EntityCreature//Еще тут может быть EntityAnimal для пассивного моба, еще есть IAnimal и EntityCreature, но о них позже.
{
boolean mot = false;
int time = 0;
public salamandra(World par1World)
{
super(par1World);
this.setSize(1.0F, 0.5F); //Размерчики
this.setEquipmentDropChance(1, 1.0F); //Шанс дропа экипировки
this.setCanPickUpLoot(true); //Может подбирать лут
//AI.... Тут тупо поможет перевод названий классов.
this.tasks.addTask(1, new EntityAISwimming(this)); //Плавает
this.tasks.addTask(5, new EntityAIWander(this, 0.8D));//Хрен от вас отстанет
this.tasks.addTask(6, new EntityAIWatchClosest(this, salamandra.class, 8.0F)); //Смотрит на вас
this.tasks.addTask(6, new EntityAILookIdle(this)); //Просто смотрит
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, salamandra.class, 0, true)); //Подходит
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100000.0D); //Макс хп у моба.
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.0D);//Скорость передвижения
}
@Override
protected String getLivingSound()
{
return "yourmod:MobLiving";//Это обычные звуки, их в yourmod/sound/MobLiving.
}
@Override
protected String getHurtSound()
{
return "yourmod:HurtLiving";//Это звуки урона, их туда же.
}
@Override
protected String getDeathSound()
{
return "yourmod:DeathLiving";//Типо звуки смерти.
}
@Override
protected float getSoundVolume() //Громкость звуков
{
return 0.4F;
}
public void updateEntity() {
if(mot= true){
if (time >= 20 * 4 ) time = 0;
++time;
}}
}
Последнее редактирование: