Mod [Help]Bug ajout mob.

MrFarooch

Architecte en herbe
9 Novembre 2012
35
1
69
J'ai créé ce sujet car j'ai besoin d'aide.(logique ?^^)

Le problème: J'ai créer un mob. Quand je me connecte en Solo je peux ouvrir l'inventaire et voir l’œuf du mob que j'ai crée mais dès que je l'utilise Minecraft crash, il y des fois je n'ai pas besoin d'utiliser l’œuf (je crash avant). J'en déduit que Minecraft crash quand le mob ajouté spawn.
J'espère que vous pourrez me donner la solution ! :)


-J'ai créé un mob avec Techne j'ai fait la texture (tous vas bien)
-J'ai généré le le code de mon mob

Code:
package net.minecraft.src;
 
public class ModelBouftou extends ModelBase
{
  //fields
    ModelRenderer corps;
    ModelRenderer Shape1;
    ModelRenderer Shape1;
    ModelRenderer Shape1;
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape3;
 
  public ModelBouftou()
  {
    textureWidth = 64;
    textureHeight = 32;
   
      corps.mirror = true;
      corps = new ModelRenderer(this, 0, 11);
      corps.addBox(0F, 0F, 0F, 10, 10, 10);
      corps.setRotationPoint(-5F, 10F, -5F);
      corps.setTextureSize(64, 32);
      corps.mirror = true;
      setRotation(corps, 0F, 0F, 0F);
      corps.mirror = false;
      Shape1 = new ModelRenderer(this, 28, 0);
      Shape1.addBox(-1F, 0F, -1F, 2, 4, 2);
      Shape1.setRotationPoint(3F, 20F, 3F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape1 = new ModelRenderer(this, 28, 0);
      Shape1.addBox(-1F, 0F, -1F, 2, 4, 2);
      Shape1.setRotationPoint(-2F, 20F, 3F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape1 = new ModelRenderer(this, 28, 0);
      Shape1.addBox(-1F, 0F, -1F, 2, 4, 2);
      Shape1.setRotationPoint(-2F, 20F, -3F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape1 = new ModelRenderer(this, 28, 0);
      Shape1.addBox(-1F, 0F, -1F, 2, 4, 2);
      Shape1.setRotationPoint(3F, 20F, -3F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 10, 0);
      Shape2.addBox(0F, 0F, 0F, 3, 1, 1);
      Shape2.setRotationPoint(-7F, 12F, -1F);
      Shape2.setTextureSize(64, 32);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 45, 0);
      Shape2.addBox(0F, 0F, 0F, 3, 1, 1);
      Shape2.setRotationPoint(4F, 12F, -1F);
      Shape2.setTextureSize(64, 32);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 10, 0);
      Shape3.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape3.setRotationPoint(-7F, 11F, -1F);
      Shape3.setTextureSize(64, 32);
      Shape3.mirror = true;
      setRotation(Shape3, 0F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 45, 0);
      Shape3.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape3.setRotationPoint(6F, 11F, -1F);
      Shape3.setTextureSize(64, 32);
      Shape3.mirror = true;
      setRotation(Shape3, 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);
    corps.render(f5);
    Shape1.render(f5);
    Shape1.render(f5);
    Shape1.render(f5);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape3.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);
  }
 
}

J'ai aussi essayé ça :

Code:
package net.minecraft.src;
 
public class ModelBouftou extends ModelBase
{
 
    ModelRenderer corps;
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    ModelRenderer Shape5;
    ModelRenderer Shape6;
    ModelRenderer Shape7;
    ModelRenderer Shape8;
 
  public ModelBouftou()
  {
    textureWidth = 64;
    textureHeight = 32;
   
      corps.mirror = true;
      corps = new ModelRenderer(this, 0, 11);
      corps.addBox(0F, 0F, 0F, 10, 10, 10);
      corps.setRotationPoint(-5F, 10F, -5F);
      corps.setTextureSize(64, 32);
      corps.mirror = true;
      setRotation(corps, 0F, 0F, 0F);
      corps.mirror = false;
      Shape1 = new ModelRenderer(this, 28, 0);
      Shape1.addBox(-1F, 0F, -1F, 2, 4, 2);
      Shape1.setRotationPoint(3F, 20F, 3F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 28, 0);
      Shape2.addBox(-1F, 0F, -1F, 2, 4, 2);
      Shape2.setRotationPoint(-2F, 20F, 3F);
      Shape2.setTextureSize(64, 32);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 28, 0);
      Shape3.addBox(-1F, 0F, -1F, 2, 4, 2);
      Shape3.setRotationPoint(-2F, 20F, -3F);
      Shape3.setTextureSize(64, 32);
      Shape3.mirror = true;
      setRotation(Shape3, 0F, 0F, 0F);
      Shape4 = new ModelRenderer(this, 28, 0);
      Shape4.addBox(-1F, 0F, -1F, 2, 4, 2);
      Shape4.setRotationPoint(3F, 20F, -3F);
      Shape4.setTextureSize(64, 32);
      Shape4.mirror = true;
      setRotation(Shape4, 0F, 0F, 0F);
      Shape5 = new ModelRenderer(this, 10, 0);
      Shape5.addBox(0F, 0F, 0F, 3, 1, 1);
      Shape5.setRotationPoint(-7F, 12F, -1F);
      Shape5.setTextureSize(64, 32);
      Shape5.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape6 = new ModelRenderer(this, 45, 0);
      Shape6.addBox(0F, 0F, 0F, 3, 1, 1);
      Shape6.setRotationPoint(4F, 12F, -1F);
      Shape6.setTextureSize(64, 32);
      Shape6.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape7 = new ModelRenderer(this, 10, 0);
      Shape7.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape7.setRotationPoint(-7F, 11F, -1F);
      Shape7.setTextureSize(64, 32);
      Shape7.mirror = true;
      setRotation(Shape7, 0F, 0F, 0F);
      Shape8 = new ModelRenderer(this, 45, 0);
      Shape8.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape8.setRotationPoint(6F, 11F, -1F);
      Shape8.setTextureSize(64, 32);
      Shape8.mirror = true;
      setRotation(Shape8, 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);
    corps.render(f5);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.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);
  }
 
}

Voici mon EntityMob :

Code:
package net.minecraft.src;
 
public class EntityBouftou extends EntityMob
{
public EntityBouftou(World par1World)
{
super(par1World);
this.texture = "/mob/Bouftou.png";//la texture du mob
this.moveSpeed = 0.7f;//sa vitesse
isImmuneToFire = false; // Immunisé au feu ? TRUE = Oui / False = NON
 
// l'IA DU MOB ! prenez le temps de regarder sur d'autre Mob les commandes et ce qu'elle entraîne !
 
 
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
this.tasks.addTask(2, new EntityAIMoveTwardsRestriction(this, this.moveSpeed));
this.tasks.addTask(3, new EntityAIWander(this, this.moveSpeed));
this.tasks.addTask(4, new EntityAILookIdle(this));
this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 25.0F, 0, true));
 
}
 
public int func_82193_c(Entity par1Entity)
{
return 4; // Les dégât créer par le mob
}
 
protected void fall(float par1) {}
public int getMaxHealth()
{
return 12; // Sa barre de vie.
}
 
protected String getLivingSound()
{
return "mob.sheep.say";  //Sons en vie
}
 
protected String getHurtSound()
{
return "mob.sheep.say"; //Sons quand prise de dégât ( heurte le sol)
}
 
protected String getDeathSound()
{
return "mob.sheep.death"; //Sons de sa mort
}
 
protected int getDropItemId()
{
    return Block.cloth.blockID;
}
protected boolean canDespawn() // Le mob despawn ?
{
return false;
}
 
protected boolean isAIEnabled()
{
return true;
}
}

Je suis en 1.5.2 et j'utilise ModLoader 1.5.2

La console Eclipse :

Code:
Starting up SoundSystem...
Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
OpenAL initialized.
 
2013-07-06 21:15:45 [CLIENT] [INFO] Found animation info for: textures/blocks/lava_flow.txt
2013-07-06 21:15:45 [CLIENT] [INFO] Found animation info for: textures/blocks/water_flow.txt
2013-07-06 21:15:45 [CLIENT] [INFO] Found animation info for: textures/blocks/fire_0.txt
2013-07-06 21:15:45 [CLIENT] [INFO] Found animation info for: textures/blocks/fire_1.txt
2013-07-06 21:15:45 [CLIENT] [INFO] Found animation info for: textures/blocks/lava.txt
2013-07-06 21:15:45 [CLIENT] [INFO] Found animation info for: textures/blocks/portal.txt
2013-07-06 21:15:45 [CLIENT] [INFO] Found animation info for: textures/blocks/water.txt
2013-07-06 21:15:46 [CLIENT] [INFO] Found animation info for: textures/items/clock.txt
2013-07-06 21:15:46 [CLIENT] [INFO] Found animation info for: textures/items/compass.txt
2013-07-06 21:15:50 [SERVER] [INFO] Starting integrated minecraft server version 1.5.2
2013-07-06 21:15:50 [SERVER] [INFO] Generating keypair
2013-07-06 21:15:50 [SERVER] [INFO] Preparing start region for level 0
2013-07-06 21:15:51 [SERVER] [INFO] Preparing spawn area: 58%
2013-07-06 21:15:52 [SERVER] [INFO] Player184[/127.0.0.1:0] logged in with entity id 573 at (50.5, 66.0, 258.5)
loading single player
2013-07-06 21:15:55 [CLIENT] [WARNING] Skipping Entity with id -24
net.minecraft.src.ReportedException: Exception in world tick
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1863)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:828)
    at net.minecraft.client.Minecraft.run(Minecraft.java:753)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at net.minecraft.src.NetClientHandler.handleMobSpawn(NetClientHandler.java:756)
    at net.minecraft.src.Packet24MobSpawn.processPacket(Packet24MobSpawn.java:137)
    at net.minecraft.src.MemoryConnection.processReadPackets(MemoryConnection.java:74)
    at net.minecraft.src.NetClientHandler.processReadPackets(NetClientHandler.java:100)
    at net.minecraft.src.WorldClient.tick(WorldClient.java:64)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1847)
    ... 3 more
2013-07-06 21:15:57 [SERVER] [INFO] Stopping server
2013-07-06 21:15:57 [SERVER] [INFO] Saving players
2013-07-06 21:15:57 [SERVER] [INFO] Saving worlds
2013-07-06 21:15:57 [SERVER] [INFO] Saving chunks for level 'New World'/Overworld
2013-07-06 21:15:59 [SERVER] [INFO] Saving chunks for level 'New World'/Nether
2013-07-06 21:15:59 [SERVER] [INFO] Saving chunks for level 'New World'/The End
2013-07-06 21:16:06 [CLIENT] [INFO] Stopping!
 
SoundSystem shutting down...
    Author: Paul Lamb, www.paulscode.com
 
Someone is closing me!

Et le rapport de crash minecraft :

Code:
Minecraft has crashed!     
      ----------------------     
 
Minecraft has stopped running because it encountered a problem; Unexpected error
 
A full error report has been saved to C:\Users\Annie\Desktop\MCP\jars\.\crash-reports\crash-2013-07-06_21.29.16-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash :(
 
 
 
--- BEGIN ERROR REPORT b9481015 --------
Full report at:
C:\Users\Annie\Desktop\MCP\jars\.\crash-reports\crash-2013-07-06_21.29.16-client.txt
Please show that file to Mojang, NOT just this screen!
 
Generated 06/07/13 21:29
 
-- Head --
Stacktrace:
    at net.minecraft.src.NetClientHandler.handleMobSpawn(NetClientHandler.java:756)
    at net.minecraft.src.Packet24MobSpawn.processPacket(Packet24MobSpawn.java:137)
    at net.minecraft.src.MemoryConnection.processReadPackets(MemoryConnection.java:74)
 
-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityClientPlayerMP['Player24'/572, l='MpServer', x=1,50, y=65,62, z=243,50]]
    Chunk stats: MultiplayerChunkCache: 15
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options:
    Level spawn location: World: (8,64,245), Chunk: (at 8,4,5 in 0,15; contains blocks 0,0,240 to 15,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 52 game time, 52 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
    Forced entities: 5 total; [EntityCow['Cow'/455, l='MpServer', x=35,84, y=63,00, z=229,47], EntityCow['Cow'/454, l='MpServer', x=34,31, y=63,00, z=229,47], EntityCow['Cow'/453, l='MpServer', x=39,13, y=63,00, z=230,56], EntityCow['Cow'/452, l='MpServer', x=36,78, y=63,00, z=230,59], EntityClientPlayerMP['Player24'/572, l='MpServer', x=1,50, y=65,62, z=243,50]]
    Retry entities: 0 total; []
Stacktrace:
    at net.minecraft.src.WorldClient.addWorldInfoToCrashReport(WorldClient.java:405)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2446)
    at net.minecraft.client.Minecraft.run(Minecraft.java:776)
    at java.lang.Thread.run(Unknown Source)
 
-- System Details --
Details:
    Minecraft Version: 1.5.2
    Operating System: Windows 7 (amd64) version 6.1
    Java Version: 1.7.0_25, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 939626968 bytes (896 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    AABB Pool Size: 10817 (605752 bytes; 0 MB) allocated, 10817 (605752 bytes; 0 MB) used
    Suspicious classes: Start[net.minecraft.src.IPlayerUsage, ILogAgent, MinecraftFakeLauncher, ...]
    IntCache: cache: 0, tcache: 0, allocated: 1, tallocated: 63
    LWJGL: 2.4.2
    OpenGL: ATI Radeon HD 4200 GL version 2.1.8787, ATI Technologies Inc.
    Is Modded: Very likely; Jar signature invalidated
    Type: Client (map_client.txt)
    Texture Pack: Default
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
 
java.lang.NullPointerException
    at net.minecraft.src.NetClientHandler.handleMobSpawn(NetClientHandler.java:756)
    at net.minecraft.src.Packet24MobSpawn.processPacket(Packet24MobSpawn.java:137)
    at net.minecraft.src.MemoryConnection.processReadPackets(MemoryConnection.java:74)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1884)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:828)
    at net.minecraft.client.Minecraft.run(Minecraft.java:753)
    at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 49d3b420 ----------


Dites moi si il vous faut quelque chose de plus pour m'aider. :)
 
@Rems19 : Tu as bien compris comment fonctionne ModLoader.

Perso, je suis plus sur Forge.

@MrFarooch : Modifié des class de Minecraft déjà existantes interdit toute compatibilité entre les mods.
 
Je connais les 2 même si je n'ai jamais touché à modLoader. J'ai essayé Forge mais en fait, je n'arrive pas encore à tout comprendre. En revanche je me de débrouille en java et je sais faire des plugins Bukkit, donc j'arrive quand même à cerner certains points :)