Posted November 30, 201311 yr I've implemented 3 mobs currently in my mod but for some reason they are all rendering the same. They also are spawning way too much. Here is my code: Main class: EntityRegistry.registerModEntity(EntityTurkey.class, "Turkey", 1, this, 80, 3, true); EntityRegistry.addSpawn(EntityTurkey.class, 5, 1, 3, EnumCreatureType.ambient, BiomeGenBase.forest, BiomeGenBase.forestHills); LanguageRegistry.instance().addStringLocalization("entity.PenguinMod.Turkey.name", "Turkey"); registerEntityEgg(EntityTurkey.class, 0x895D42, 0xDD2B1F); RenderingRegistry.registerEntityRenderingHandler(EntityTurkey.class, new RenderTurkey(new ModelTurkey(), 0.3f)); EntityRegistry.registerModEntity(EntityPenguin.class, "Penguin", 1, this, 80, 3, true); EntityRegistry.addSpawn(EntityPenguin.class, 5, 1, 3, EnumCreatureType.ambient, BiomeGenBase.frozenRiver, BiomeGenBase.iceMountains, BiomeGenBase.taiga, BiomeGenBase.taigaHills, BiomeGenBase.icePlains); LanguageRegistry.instance().addStringLocalization("entity.PenguinMod.Penguin.name", "Penguin"); registerEntityEgg(EntityPenguin.class, 0x4D4D4D, 0xFFFFFF); RenderingRegistry.registerEntityRenderingHandler(EntityPenguin.class, new RenderPenguin(new ModelPenguin(), 0.3f)); EntityRegistry.registerModEntity(EntityCoconut.class, "Coconut", 1, this, 80, 3, true); EntityRegistry.addSpawn(EntityCoconut.class, 5, 1, 10, EnumCreatureType.ambient, BiomeGenBase.desert, BiomeGenBase.beach, BiomeGenBase.desertHills); LanguageRegistry.instance().addStringLocalization("entity.PenguinMod.Coconut.name", "Coconut"); registerEntityEgg(EntityCoconut.class, 0x895400, 0x000000); RenderingRegistry.registerEntityRenderingHandler(EntityCoconut.class, new RenderCoconut(new ModelCoconut(), 0.3f)); Client Proxy: package TylerWatson.Mod; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraftforge.client.MinecraftForgeClient; public class ClientProxy extends CommonProxy { @Override public void registerRenderers() { // This is for rendering entities and so forth later on //MinecraftForgeClient.preloadTexture("/tutorialblocks.png"); RenderingRegistry.registerEntityRenderingHandler(EntityTurkey.class, new RenderTurkey(new ModelTurkey(), 0.3F)); RenderingRegistry.registerEntityRenderingHandler(EntityPenguin.class, new RenderPenguin(new ModelPenguin(), 0.3F)); RenderingRegistry.registerEntityRenderingHandler(EntityCoconut.class, new RenderCoconut(new ModelCoconut(), 0.3F)); } } RenderTurkey: package TylerWatson.Mod; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.util.ResourceLocation; public class RenderTurkey extends RenderLiving { protected ModelTurkey model; public RenderTurkey(ModelBase par1ModelBase, float par2){ super(par1ModelBase, par2); model = ((ModelTurkey)mainModel); } public void renderTurkey(EntityTurkey entity, double par2, double par4, double par6, float par8, float par9){ super.doRenderLiving(entity, par2, par4, par6, par8, par9); } public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9){ renderTurkey((EntityTurkey) par1EntityLiving, par2, par4, par6, par8, par9); } @Override public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { renderTurkey((EntityTurkey)entity, d0, d1, d2, f, f1); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return new ResourceLocation("penguinmod:textures/models/mob/Turkey.png"); } } RenderPenguin: ackage TylerWatson.Mod; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.util.ResourceLocation; public class RenderPenguin extends RenderLiving { protected ModelPenguin model; public RenderPenguin(ModelBase par1ModelBase, float par2){ super(par1ModelBase, par2); model = ((ModelPenguin)mainModel); } public void renderPenguin(EntityPenguin entity, double par2, double par4, double par6, float par8, float par9){ super.doRenderLiving(entity, par2, par4, par6, par8, par9); } public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9){ renderPenguin((EntityPenguin) par1EntityLiving, par2, par4, par6, par8, par9); } @Override public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { renderPenguin((EntityPenguin)entity, d0, d1, d2, f, f1); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return new ResourceLocation("penguinmod:textures/models/mob/Penguin.png"); } } RenderCoconut: package TylerWatson.Mod; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.util.ResourceLocation; public class RenderCoconut extends RenderLiving { protected ModelCoconut model; public RenderCoconut(ModelBase par1ModelBase, float par2){ super(par1ModelBase, par2); model = ((ModelCoconut)mainModel); } public void renderCoconut(EntityCoconut entity, double par2, double par4, double par6, float par8, float par9){ super.doRenderLiving(entity, par2, par4, par6, par8, par9); } public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9){ renderCoconut((EntityCoconut) par1EntityLiving, par2, par4, par6, par8, par9); } @Override public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { renderCoconut((EntityCoconut)entity, d0, d1, d2, f, f1); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return new ResourceLocation("penguinmod:textures/models/mob/Coconut.png"); } } If you need to see anymore code just ask for it and I'll post it. Why do all of mobs look like my Turkey mob and why do they spawn all over the place?
December 1, 201311 yr First off you gave them all the same id "1" so of course they are all going to render exactly the same. As for the spawning, please share your entity code, there are ways to force them to spawn more which could be a coding bug in the entity class, this would most likely have to do with spawning a child and having it do the wrong check. Also, why are you registering the entity renders twice? You should only have them im the ClientProxy.class file and thats it, this will make your mod SMP if you utilize client register in ClientProxy.class.
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.