Posted October 23, 201311 yr The problem is that I have two mobs, Bulbasaur and Charmander, when I run minecraft the models are correct and Bulbasaur has the right texture, but charmander has the wrong texture Basic.java = base mod file mobBulbasaur and mobCharmander = entity mob java classes Base Mod File package mypackage; import mymobs.mobBulbasaur; import mymobs.mobCharmander; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EnumCreatureType; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.MinecraftForge; 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.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="Basic", name="Basic", version="0.0.0") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class Basic { // The instance of your mod that Forge uses. @Instance("Basic") public static Basic instance; // Says where the client and server proxy code is loaded. @SidedProxy(clientSide="tutorial.basic.client.ClientProxy", serverSide="mypackage.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { // Stub Method } @EventHandler public void load(FMLInitializationEvent event) {//load proxy.registerRenderers(); //mob test // registerEntity([mob class name].class, "[name]", 0x[hex spawn egg color], 0x[hex spawn egg color]); //238E23 029D74 // LanguageRegistry.instance().addStringLocalization("entity.[mob class].name", "[Human read name]"); registerEntity(mobBulbasaur.class, "mobBulbasaur", 0x238E23, 0x029D74); //238E23 029D74 LanguageRegistry.instance().addStringLocalization("entity.mobBulbasaur.name", "Bulbasaur"); registerEntity(mobCharmander.class, "mobCharmander", 0xFF7F24, 0xFFD700); //238E23 029D74 LanguageRegistry.instance().addStringLocalization("entity.mobCharmander.name", "Charmander"); } @EventHandler public void postInit(FMLPostInitializationEvent event) { // Stub Method } public void registerEntity(Class<? extends Entity> entityClass, String entityName, int bkEggColor, int fgEggColor) { int id = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(entityClass, entityName, id); EntityList.entityEggs.put(Integer.valueOf(id), new EntityEggInfo(id, bkEggColor, fgEggColor)); } public void addSpawn1(Class<? extends EntityLiving> entityClass, int spawnProb, int min, int max, BiomeGenBase[] biomes) { if (spawnProb > 0) { EntityRegistry.addSpawn(entityClass, spawnProb, min, max, EnumCreatureType.creature, biomes); } } } } Bulbasaur (Mob that works class) package mymobs; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.SharedMonsterAttributes; //import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAILookIdle; //import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAIPanic; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class mobBulbasaur extends EntityAnimal { public mobBulbasaur(World par1World) { super(par1World); this.setSize(0.9F, 1.3F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIPanic(this, 2.0D)); //this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); //this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Item.wheat.itemID, false)); //this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(7, new EntityAILookIdle(this)); } /** * Returns true if the newer Entity AI code should be run */ public boolean isAIEnabled() { return true; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D); } /** * Returns the sound this mob makes while it's alive. */ protected String getLivingSound() { return ""; } /** * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return ""; } /** * Returns the sound this mob makes on death. */ protected String getDeathSound() { return ""; } /** * Plays step sound at given x, y, z for the entity */ protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("", 0.15F, 1.0F); } /** * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 0.4F; } /** * Returns the item ID for the item the mob drops on death. */ protected int getDropItemId() { return Item.leather.itemID; } /** * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param * par2 - Level of Looting used to kill this mob. */ protected void dropFewItems(boolean par1, int par2) { int j = this.rand.nextInt(3) + this.rand.nextInt(1 + par2); int k; for (k = 0; k < j; ++k) { /*TODO*/ this.dropItem(Item.leather.itemID, 1); } j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2); for (k = 0; k < j; ++k) { if (this.isBurning()) { this.dropItem(Item.beefCooked.itemID, 1); } else { this.dropItem(Item.beefRaw.itemID, 1); } } } public mobBulbasaur spawnBabyAnimal(EntityAgeable par1EntityAgeable) { return new mobBulbasaur(this.worldObj); } public EntityAgeable createChild(EntityAgeable par1EntityAgeable) { return this.spawnBabyAnimal(par1EntityAgeable); } @SideOnly(Side.CLIENT) public static class RenderTheMob extends RenderLiving { private static final ResourceLocation bulbasaur = new ResourceLocation("basic", "/textures/mobs/BulbasaurTexture.png"); public RenderTheMob(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return bulbasaur; } } } Charmander (Mob that doesn't work) package mymobs; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.SharedMonsterAttributes; //import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAILookIdle; //import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAIPanic; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class mobCharmander extends EntityAnimal { public mobCharmander(World par1World) { super(par1World); this.setSize(0.9F, 1.3F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIPanic(this, 2.0D)); //this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); //this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Item.wheat.itemID, false)); //this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(7, new EntityAILookIdle(this)); } /** * Returns true if the newer Entity AI code should be run */ public boolean isAIEnabled() { return true; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D); } /** * Returns the sound this mob makes while it's alive. */ protected String getLivingSound() { return ""; } /** * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return ""; } /** * Returns the sound this mob makes on death. */ protected String getDeathSound() { return ""; } /** * Plays step sound at given x, y, z for the entity */ protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("", 0.15F, 1.0F); } /** * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 0.4F; } /** * Returns the item ID for the item the mob drops on death. */ protected int getDropItemId() { return Item.magmaCream.itemID; } /** * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param * par2 - Level of Looting used to kill this mob. */ protected void dropFewItems(boolean par1, int par2) { int j = this.rand.nextInt(3) + this.rand.nextInt(1 + par2); int k; for (k = 0; k < j; ++k) { /*TODO*/ this.dropItem(Item.magmaCream.itemID, 1); this.dropItem(Item.blazePowder.itemID, 1); } j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2); { } } /** * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ /** * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. */ public mobCharmander spawnBabyAnimal(EntityAgeable par1EntityAgeable) { return new mobCharmander(this.worldObj); } public EntityAgeable createChild(EntityAgeable par1EntityAgeable) { return this.spawnBabyAnimal(par1EntityAgeable); } @SideOnly(Side.CLIENT) public static class RenderTheMob extends RenderLiving { private static final ResourceLocation charmander = new ResourceLocation("basic", "/textures/mobs/CharmanderTexture.png"); public RenderTheMob(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return charmander; } } } Client Proxy Class package tutorial.basic.client; import net.minecraft.client.renderer.entity.Render; import mymobs.ModelBulbasaur; import mymobs.ModelCharmander; import mymobs.mobBulbasaur; import mymobs.mobBulbasaur.RenderTheMob; import mymobs.mobCharmander; import mypackage.CommonProxy; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { public void registerRenderers() { // This is for rendering entities and so forth later on RenderingRegistry.registerEntityRenderingHandler(mobBulbasaur.class, new RenderTheMob(new ModelBulbasaur(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(mobCharmander.class, new RenderTheMob(new ModelCharmander(), 0.5F)); } } I also have the Model[insert mob here] classes but I that is not the problem
October 23, 201311 yr import mymobs.mobBulbasaur; import mymobs.mobBulbasaur.RenderTheMob; import mymobs.mobCharmander; import mypackage.CommonProxy; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { public void registerRenderers() { // This is for rendering entities and so forth later on RenderingRegistry.registerEntityRenderingHandler(mobBulbasaur.class, new RenderTheMob(new ModelBulbasaur(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(mobCharmander.class, new RenderTheMob(new ModelCharmander(), 0.5F)); The imports are telling me you are using the same RenderTheMob class for both. private static final ResourceLocation charmander = new ResourceLocation("basic", "/textures/mobs/CharmanderTexture.png"); Need to drop the / before textures/mobs...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.