хочу создать моба со своей моделькой, но почему красным горит setAttribute в классе моба
и loadModel в классе модели
и вооще есть ли тут еще что то неправильное?
модель
моб
и loadModel в классе модели
и вооще есть ли тут еще что то неправильное?
модель
Java:
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class ModelSalamandra extends ModelBase
{
private static ResourceLocation tex = new ResourceLocation("devo", "obj/salamandra.png");
private IModelCustom model = AdvancedModelLoader.loadModel("/assets/devo/obj/salamandra.obj");
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
GL11.glPushMatrix();
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glTranslatef(0F, 0.5F, 0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 1.0F, 0.0F, 0.0F);
GL11.glScaled(1.0D, 1.0D, 1.0D);
Minecraft.getMinecraft().renderEngine.bindTexture(tex);
model.renderAll();
GL11.glDisable(3042);
GL11.glPopMatrix();
}
}
Java:
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public class salamandra extends EntityCreature//Еще тут может быть EntityAnimal для пассивного моба, еще есть IAnimal и EntityCreature, но о них позже.
{
public salamandra(World par1World)
{
super(par1World);
this.setSize(0.7F, 1.8F); //Размерчики
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).setAttribute(10.0D); //Макс хп у моба.
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D);//Скорость передвижения
}
@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;
}
Последнее редактирование: