Créer un mob basique
-
Voilà pourquoi cela ne fonctionne pas. Change l’import par Java.util.quelquechose.Color.
-
voila j ai trouver pour importer mais ca ne marche toujours pas voici mes class:
1er la class principal
2eme la classe Render
3eme la class du mob
4eme la classe Clientproxy -
Classe principale il te manque proxy.registerRender(); dans la fonction init.
Et tu as des { } qui ne servent à rien dans la fonction init. -
nn meme en rajout
ant le proxy.registerRender(); ca ne marche pas ca me dit qu il y a une erreur dans le pre-init:
-
Tu peux donner le crash complet parce que les caractéristiques de ton pc ne vont pas nous aider.
-
pas con ^^
-
Tu as quoi ici com.mano.nouveauxelements.nouveauxelements.init(nouveauxelements.java:123) ?
-
c est ma classe principal ca
-
Et la ligne 123?
-
c est ca EntityRegistry.registerModEntity(wraith.class, “mob”, 420, this.instance, 40, 1, true);
-
Tu peux me donner l’intégralité de ta class principale?
-
voila :
-
Ton instance n’est pas la même que ton modid …
@Mod(modid = “nouveauxelements”@Instance(“modtnt”)
public static nouveauxelements instance;Ça devrait être :
@Instance(“nouveauxelements”)En passant, languageRegistry n’est plus a utiliser, il y a les fichiers de langage maintenant.
-
merci beaucoup ca marche
et pour le fichier de language j y comprend pas grand chose … -
Regarde les tutoriels en vidéo si les textes ne sont pas assez clair, c’est pourtant simple à utiliser x)
-
Oui je me doute je me suis pas trop pencher dessus
-
Hello, merci pour ce tutoriel, mais il y a un gros problème, je n’est pas l’oeuf dans l’inventaire créative, voici le mob :
http://www.hostingpics.net/viewer.php?id=953538Guardien3D.png
SI quelqu’un peut m’aider via teamviewer, car c’est long a expliqué.
-
Envoie ton code.
-
EntityGuardien
package fr.wenuz.battleroyal.common; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; import net.minecraft.world.World; public class EntityGuardien extends EntityMob { public EntityGuardien(World par1World) { super(par1World); } public void applyEntityAttribute() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(400); getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.60000002384185791D); getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); } }
RenderGuardien
package fr.wenuz.battleroyal.client; import fr.wenuz.battleroyal.common.EntityGuardien; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.util.ResourceLocation; public class RenderGuardien extends RenderLiving { public final ResourceLocation texture = new ResourceLocation("br:texture/entity/Guardien.png"); public RenderGuardien(ModelBase par1ModelBase) { super(par1ModelBase, 0.5F); } public ResourceLocation bindEntityTexture(EntityGuardien mob) { return texture; } @Override protected ResourceLocation getEntityTexture(Entity entity) { return bindEntityTexture((EntityGuardien)entity); } }
Classe Principal
package fr.wenuz.battleroyal.common; import net.minecraft.entity.Entity; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.EntityRegistry; import fr.wenuz.battleroyal.proxy.CommonProxy; @Mod(modid = "br", name = "BattleRoyal", version = "1.0.0" ) public class Modbr { @Instance("br") public static Modbr instance; @SidedProxy(clientSide ="fr.wenuz.battleroyal.proxy.ClientProxy", serverSide = "fr.wenuz.battleroyal.proxy.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { } public void Init(FMLInitializationEvent event) { addEntity(EntityGuardien.class, "Guardien", 550, 0, 0); proxy.registerRender(); } public void postInit(FMLPostInitializationEvent event) { } public void addEntity(Class entityClass, String name, int id, int backgroundColor, int foregroundColor) { EntityRegistry.registerGlobalEntityID(entityClass, name, EntityRegistry.findGlobalUniqueEntityId(), backgroundColor, foregroundColor); EntityRegistry.registerModEntity(entityClass, name, id, this, 40, 1, true); } }
ClientProxy
package fr.wenuz.battleroyal.proxy; import net.minecraft.client.model.ModelBiped; import cpw.mods.fml.client.registry.RenderingRegistry; import fr.wenuz.battleroyal.client.RenderGuardien; import fr.wenuz.battleroyal.common.EntityGuardien; import fr.wenuz.battleroyal.common.ModelGuardien; public class ClientProxy extends CommonProxy { public void registerRender() { RenderingRegistry.registerEntityRenderingHandler(EntityGuardien.class, new RenderGuardien(new ModelGuardien())); } }
CommonProxy
package fr.wenuz.battleroyal.proxy; public class CommonProxy { public void registerRender() { } }
ModelGuardien
package fr.wenuz.battleroyal.common; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelGuardien extends ModelBase { //fields ModelRenderer head; ModelRenderer Corne1; ModelRenderer Corne2; ModelRenderer Corne3; ModelRenderer Corne4; ModelRenderer Petitecorne1; ModelRenderer Petitecorne2; ModelRenderer Petitcorne3; ModelRenderer Petitecorne4; ModelRenderer Petitecorne5; ModelRenderer Petitecorne6; ModelRenderer Petitecorne7; ModelRenderer Petitecorne8; ModelRenderer Corne5; ModelRenderer corne6; ModelRenderer corne7; ModelRenderer corne8; ModelRenderer corne9; ModelRenderer corne10; ModelRenderer corne11; ModelRenderer corne12; ModelRenderer Générateur; ModelRenderer Cable13; ModelRenderer Cable14; ModelRenderer Cable15; ModelRenderer Cable16; ModelRenderer Cable17; ModelRenderer Cable18; ModelRenderer Cable19; ModelRenderer Cable20; ModelRenderer bras1; ModelRenderer bras2; ModelRenderer bras3; ModelRenderer bras4; ModelRenderer main1; ModelRenderer main2; ModelRenderer Petitecorne9; ModelRenderer Petitecorne10; ModelRenderer Petitecorne11; ModelRenderer Petitecorne12; ModelRenderer Petitecorne13; ModelRenderer Petitecorne14; ModelRenderer Petitecorne15; ModelRenderer Petitecorne16; public ModelGuardien() { textureWidth = 256; textureHeight = 256; head = new ModelRenderer(this, 0, 0); head.addBox(-4F, -8F, -4F, 17, 17, 17); head.setRotationPoint(-4F, 0F, 0F); head.setTextureSize(256, 256); head.mirror = true; setRotation(head, 0F, 0F, 0F); Corne1 = new ModelRenderer(this, 2, 39); Corne1.addBox(1F, 0F, 1F, 3, 1, 20); Corne1.setRotationPoint(-2F, -9F, -7F); Corne1.setTextureSize(256, 256); Corne1.mirror = true; setRotation(Corne1, 0F, 0F, 0F); Corne2 = new ModelRenderer(this, 2, 115); Corne2.addBox(0F, 0F, 0F, 3, 1, 20); Corne2.setRotationPoint(-1F, 9F, -6F); Corne2.setTextureSize(256, 256); Corne2.mirror = true; setRotation(Corne2, 0F, 0F, 0F); Corne3 = new ModelRenderer(this, 2, 63); Corne3.addBox(0F, 0F, 0F, 1, 3, 20); Corne3.setRotationPoint(-9F, -1F, -6F); Corne3.setTextureSize(256, 256); Corne3.mirror = true; setRotation(Corne3, 0F, 0F, 0F); Corne4 = new ModelRenderer(this, 2, 89); Corne4.addBox(0F, 0F, 0F, 1, 3, 20); Corne4.setRotationPoint(9F, -1F, -6F); Corne4.setTextureSize(256, 256); Corne4.mirror = true; setRotation(Corne4, 0F, 0F, 0F); Petitecorne1 = new ModelRenderer(this, 63, 117); Petitecorne1.addBox(0F, 0F, 0F, 2, 1, 10); Petitecorne1.setRotationPoint(17F, 0F, -2F); Petitecorne1.setTextureSize(256, 256); Petitecorne1.mirror = true; setRotation(Petitecorne1, 0F, 0F, 0F); Petitecorne2 = new ModelRenderer(this, 63, 117); Petitecorne2.addBox(0F, 0F, 0F, 2, 1, 10); Petitecorne2.setRotationPoint(-17F, 0F, -2F); Petitecorne2.setTextureSize(256, 256); Petitecorne2.mirror = true; setRotation(Petitecorne2, 0F, 0F, 0F); Petitcorne3 = new ModelRenderer(this, 63, 117); Petitcorne3.addBox(0F, 0F, 0F, 2, 1, 10); Petitcorne3.setRotationPoint(-17F, 7F, -2F); Petitcorne3.setTextureSize(256, 256); Petitcorne3.mirror = true; setRotation(Petitcorne3, 0F, 0F, 0F); Petitecorne4 = new ModelRenderer(this, 63, 117); Petitecorne4.addBox(0F, 0F, 0F, 1, 2, 10); Petitecorne4.setRotationPoint(21F, 3F, -2F); Petitecorne4.setTextureSize(256, 256); Petitecorne4.mirror = true; setRotation(Petitecorne4, 0F, 0F, 0F); Petitecorne5 = new ModelRenderer(this, 63, 118); Petitecorne5.addBox(0F, 0F, 0F, 2, 1, 10); Petitecorne5.setRotationPoint(17F, 7F, -2F); Petitecorne5.setTextureSize(256, 256); Petitecorne5.mirror = true; setRotation(Petitecorne5, 0F, 0F, 0F); Petitecorne6 = new ModelRenderer(this, 63, 117); Petitecorne6.addBox(0F, 0F, 0F, 1, 2, 10); Petitecorne6.setRotationPoint(14F, 3F, -2F); Petitecorne6.setTextureSize(256, 256); Petitecorne6.mirror = true; setRotation(Petitecorne6, 0F, 0F, 0F); Petitecorne7 = new ModelRenderer(this, 63, 117); Petitecorne7.addBox(0F, 0F, 0F, 1, 2, 10); Petitecorne7.setRotationPoint(-13F, 3F, -2F); Petitecorne7.setTextureSize(256, 256); Petitecorne7.mirror = true; setRotation(Petitecorne7, 0F, 0F, 0F); Petitecorne8 = new ModelRenderer(this, 63, 117); Petitecorne8.addBox(0F, 0F, 0F, 1, 2, 10); Petitecorne8.setRotationPoint(-20F, 3F, -2F); Petitecorne8.setTextureSize(256, 256); Petitecorne8.mirror = true; setRotation(Petitecorne8, 0F, 0F, 0F); Corne5 = new ModelRenderer(this, 2, 146); Corne5.addBox(0F, 0F, 0F, 3, 3, 1); Corne5.setRotationPoint(-8F, -1F, -6F); Corne5.setTextureSize(256, 256); Corne5.mirror = true; setRotation(Corne5, 0F, 0F, 0F); corne6 = new ModelRenderer(this, 2, 153); corne6.addBox(0F, 0F, 0F, 3, 3, 1); corne6.setRotationPoint(6F, -1F, -6F); corne6.setTextureSize(256, 256); corne6.mirror = true; setRotation(corne6, 0F, 0F, 0F); corne7 = new ModelRenderer(this, 2, 140); corne7.addBox(0F, 0F, 0F, 3, 3, 1); corne7.setRotationPoint(-1F, -8F, -6F); corne7.setTextureSize(256, 256); corne7.mirror = true; setRotation(corne7, 0F, 0F, 0F); corne8 = new ModelRenderer(this, 2, 160); corne8.addBox(0F, 0F, 0F, 3, 3, 1); corne8.setRotationPoint(-1F, 6F, -6F); corne8.setTextureSize(256, 256); corne8.mirror = true; setRotation(corne8, 0F, 0F, 0F); corne9 = new ModelRenderer(this, 2, 168); corne9.addBox(0F, 0F, 0F, 3, 6, 1); corne9.setRotationPoint(-1F, -8F, 13F); corne9.setTextureSize(256, 256); corne9.mirror = true; setRotation(corne9, 0F, 0F, 0F); corne10 = new ModelRenderer(this, 2, 191); corne10.addBox(0F, 0F, 0F, 3, 6, 1); corne10.setRotationPoint(-1F, 3F, 13F); corne10.setTextureSize(256, 256); corne10.mirror = true; setRotation(corne10, 0F, 0F, 0F); corne11 = new ModelRenderer(this, 2, 185); corne11.addBox(0F, 0F, 0F, 6, 3, 1); corne11.setRotationPoint(-8F, -1F, 13F); corne11.setTextureSize(256, 256); corne11.mirror = true; setRotation(corne11, 0F, 0F, 0F); corne12 = new ModelRenderer(this, 2, 178); corne12.addBox(0F, 0F, 0F, 6, 3, 1); corne12.setRotationPoint(3F, -1F, 13F); corne12.setTextureSize(256, 256); corne12.mirror = true; setRotation(corne12, 0F, 0F, 0F); Générateur = new ModelRenderer(this, 20, 146); Générateur.addBox(0F, 0F, 0F, 5, 5, 4); Générateur.setRotationPoint(-2F, -2F, 13F); Générateur.setTextureSize(256, 256); Générateur.mirror = true; setRotation(Générateur, 0F, 0F, 0F); Cable13 = new ModelRenderer(this, 39, 159); Cable13.addBox(0F, 0F, 0F, 3, 1, 1); Cable13.setRotationPoint(3F, 0F, 15F); Cable13.setTextureSize(256, 256); Cable13.mirror = true; setRotation(Cable13, 0F, 0F, 0F); Cable14 = new ModelRenderer(this, 38, 159); Cable14.addBox(0F, 0F, 0F, 3, 1, 1); Cable14.setRotationPoint(-5F, 0F, 15F); Cable14.setTextureSize(256, 256); Cable14.mirror = true; setRotation(Cable14, 0F, 0F, 0F); Cable15 = new ModelRenderer(this, 26, 159); Cable15.addBox(0F, 0F, 0F, 1, 1, 1); Cable15.setRotationPoint(5F, 0F, 14F); Cable15.setTextureSize(256, 256); Cable15.mirror = true; setRotation(Cable15, 0F, 0F, 0F); Cable16 = new ModelRenderer(this, 55, 166); Cable16.addBox(0F, 0F, 0F, 1, 1, 1); Cable16.setRotationPoint(-5F, 0F, 14F); Cable16.setTextureSize(256, 256); Cable16.mirror = true; setRotation(Cable16, 0F, 0F, 0F); Cable17 = new ModelRenderer(this, 26, 159); Cable17.addBox(0F, 0F, 0F, 1, 1, 1); Cable17.setRotationPoint(0F, -5F, 14F); Cable17.setTextureSize(256, 256); Cable17.mirror = true; setRotation(Cable17, 0F, 0F, 0F); Cable18 = new ModelRenderer(this, 26, 159); Cable18.addBox(0F, 0F, 0F, 1, 1, 1); Cable18.setRotationPoint(0F, 5F, 14F); Cable18.setTextureSize(256, 256); Cable18.mirror = true; setRotation(Cable18, 0F, 0F, 0F); Cable19 = new ModelRenderer(this, 42, 165); Cable19.addBox(0F, 0F, 0F, 1, 3, 1); Cable19.setRotationPoint(0F, -5F, 15F); Cable19.setTextureSize(256, 256); Cable19.mirror = true; setRotation(Cable19, 0F, 0F, 0F); Cable20 = new ModelRenderer(this, 26, 159); Cable20.addBox(0F, 0F, 0F, 1, 3, 1); Cable20.setRotationPoint(0F, 3F, 15F); Cable20.setTextureSize(256, 256); Cable20.mirror = true; setRotation(Cable20, 0F, 0F, 0F); bras1 = new ModelRenderer(this, 99, 58); bras1.addBox(0F, 0F, 0F, 8, 3, 3); bras1.setRotationPoint(13F, 2F, 2F); bras1.setTextureSize(256, 256); bras1.mirror = true; setRotation(bras1, 0F, 0F, 0F); bras2 = new ModelRenderer(this, 99, 58); bras2.addBox(0F, 0F, 0F, 8, 3, 3); bras2.setRotationPoint(-19F, 2F, 2F); bras2.setTextureSize(256, 256); bras2.mirror = true; setRotation(bras2, 0F, 0F, 0F); bras3 = new ModelRenderer(this, 99, 58); bras3.addBox(-1F, 0F, 0F, 5, 3, 3); bras3.setRotationPoint(-12F, 2F, 2F); bras3.setTextureSize(256, 256); bras3.mirror = true; setRotation(bras3, 0F, 0F, -0.6108652F); bras4 = new ModelRenderer(this, 99, 58); bras4.addBox(0F, 0F, 0F, 5, 3, 3); bras4.setRotationPoint(10F, 0F, 2F); bras4.setTextureSize(256, 256); bras4.mirror = true; setRotation(bras4, 0F, 0F, 0.4886922F); main1 = new ModelRenderer(this, 104, 13); main1.addBox(0F, 0F, 0F, 6, 6, 7); main1.setRotationPoint(-19F, 1F, 0F); main1.setTextureSize(256, 256); main1.mirror = true; setRotation(main1, 0F, 0F, 0F); main2 = new ModelRenderer(this, 104, 13); main2.addBox(0F, 0F, 0F, 6, 6, 7); main2.setRotationPoint(15F, 1F, 0F); main2.setTextureSize(256, 256); main2.mirror = true; setRotation(main2, 0F, 0F, 0F); Petitecorne9 = new ModelRenderer(this, 63, 117); Petitecorne9.addBox(0F, 0F, 0F, 1, 2, 1); Petitecorne9.setRotationPoint(15F, 3F, -2F); Petitecorne9.setTextureSize(256, 256); Petitecorne9.mirror = true; setRotation(Petitecorne9, 0F, 0F, 0F); Petitecorne10 = new ModelRenderer(this, 63, 117); Petitecorne10.addBox(0F, 0F, 0F, 1, 2, 1); Petitecorne10.setRotationPoint(20F, 3F, -2F); Petitecorne10.setTextureSize(256, 256); Petitecorne10.mirror = true; setRotation(Petitecorne10, 0F, 0F, 0F); Petitecorne11 = new ModelRenderer(this, 63, 117); Petitecorne11.addBox(0F, 0F, 0F, 2, 1, 1); Petitecorne11.setRotationPoint(17F, 6F, -2F); Petitecorne11.setTextureSize(256, 256); Petitecorne11.mirror = true; setRotation(Petitecorne11, 0F, 0F, 0F); Petitecorne12 = new ModelRenderer(this, 63, 117); Petitecorne12.addBox(0F, 0F, 0F, 2, 1, 1); Petitecorne12.setRotationPoint(17F, 1F, -2F); Petitecorne12.setTextureSize(256, 256); Petitecorne12.mirror = true; setRotation(Petitecorne12, 0F, 0F, 0F); Petitecorne13 = new ModelRenderer(this, 63, 117); Petitecorne13.addBox(0F, 0F, 0F, 2, 1, 1); Petitecorne13.setRotationPoint(-17F, 1F, -2F); Petitecorne13.setTextureSize(256, 256); Petitecorne13.mirror = true; setRotation(Petitecorne13, 0F, 0F, 0F); Petitecorne14 = new ModelRenderer(this, 63, 117); Petitecorne14.addBox(0F, 0F, 0F, 2, 1, 1); Petitecorne14.setRotationPoint(-17F, 6F, -2F); Petitecorne14.setTextureSize(256, 256); Petitecorne14.mirror = true; setRotation(Petitecorne14, 0F, 0F, 0F); Petitecorne15 = new ModelRenderer(this, 63, 117); Petitecorne15.addBox(0F, 0F, 0F, 1, 2, 1); Petitecorne15.setRotationPoint(-14F, 3F, -2F); Petitecorne15.setTextureSize(256, 256); Petitecorne15.mirror = true; setRotation(Petitecorne15, 0F, 0F, 0F); Petitecorne16 = new ModelRenderer(this, 63, 117); Petitecorne16.addBox(0F, 0F, 0F, 1, 2, 1); Petitecorne16.setRotationPoint(-19F, 3F, -2F); Petitecorne16.setTextureSize(256, 256); Petitecorne16.mirror = true; setRotation(Petitecorne16, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); head.render(f5); Corne1.render(f5); Corne2.render(f5); Corne3.render(f5); Corne4.render(f5); Petitecorne1.render(f5); Petitecorne2.render(f5); Petitcorne3.render(f5); Petitecorne4.render(f5); Petitecorne5.render(f5); Petitecorne6.render(f5); Petitecorne7.render(f5); Petitecorne8.render(f5); Corne5.render(f5); corne6.render(f5); corne7.render(f5); corne8.render(f5); corne9.render(f5); corne10.render(f5); corne11.render(f5); corne12.render(f5); Générateur.render(f5); Cable13.render(f5); Cable14.render(f5); Cable15.render(f5); Cable16.render(f5); Cable17.render(f5); Cable18.render(f5); Cable19.render(f5); Cable20.render(f5); bras1.render(f5); bras2.render(f5); bras3.render(f5); bras4.render(f5); main1.render(f5); main2.render(f5); Petitecorne9.render(f5); Petitecorne10.render(f5); Petitecorne11.render(f5); Petitecorne12.render(f5); Petitecorne13.render(f5); Petitecorne14.render(f5); Petitecorne15.render(f5); Petitecorne16.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } }
EDIT: c’est bon sa marche, j’ai trouvé le problème
EDIT2: Je rencontre un nouveau problème les “applyEntityAttribute”, ne marche pas. j’ai mis 300 demi coeur et une vitesse de 5.0d et rien ne marche, je tue le mob en trois coup… -
normalement c’est dans ta ligne principale, normalement ta ligne ressemble a sa:
EntityRegistry.registerGlobalEntityID(ClassEntity.class,"Nom",EntityRegistry.findGlobalUniqueEntityId(), redColor, orangeColor);
ne prend pas compte des couleurs, se sont des int.
edit : si tu veux tu peux ajouter les int dessous l’instance ou au dessus de la fonction preInit :
static int redColor = (255 << 16); static int orangeColor = (255 << 16)+ (200 << 8);