Posted May 17, 20169 yr I created a custom model and texture for a mob, and everything works fine, except for ingame, the mob is just purple and black checkerboard patterns. Here are the classes I used: ClientProxy.java (proxy class is registered in main class already) package bloopers.novelties.proxy; import bloopers.novelties.entity.EntityWraithMob; import bloopers.novelties.entity.RenderWraithMob; import bloopers.novelties.entity.Wraith; import bloopers.novelties.init.NoveltiesBlocks; import bloopers.novelties.init.NoveltiesItems; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { public void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityWraithMob.class, new RenderWraithMob(Minecraft.getMinecraft().getRenderManager(), new Wraith(), 0)); NoveltiesBlocks.registerRenders(); NoveltiesItems.registerRenders(); } } EntityWraithMob.java (ai class) package bloopers.novelties.entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityFlying; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIPanic; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class EntityWraithMob extends EntityCreature { public EntityWraithMob(World worldIn) { super(worldIn); this.setSize(0.7F, 0.4F); this.tasks.addTask(0, new EntityAIWander(this, 0.5D)); this.tasks.addTask(1, new EntityAIPanic(this, 1.0D)); } public boolean isAIEnabled() { return true; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(16.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.6D); } } Wraith.java(model class) // Date: 5/17/2016 1:24:45 PM // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX package bloopers.novelties.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class Wraith extends ModelBase { //fields ModelRenderer head; ModelRenderer body; ModelRenderer rightarm; ModelRenderer leftarm; ModelRenderer dot; public Wraith() { textureWidth = 64; textureHeight = 64; head = new ModelRenderer(this, 0, 0); head.addBox(-4F, -8F, -4F, 11, 11, 11); head.setRotationPoint(-1F, 0F, 0F); head.setTextureSize(64, 64); head.mirror = true; setRotation(head, 0F, 0F, 0F); body = new ModelRenderer(this, 1, 27); body.addBox(-4F, 0F, -2F, 9, 13, 6); body.setRotationPoint(0F, 2F, 0F); body.setTextureSize(64, 64); body.mirror = true; setRotation(body, 0.5948578F, 0F, 0F); rightarm = new ModelRenderer(this, 40, 46); rightarm.addBox(-3F, -2F, -2F, 5, 12, 5); rightarm.setRotationPoint(-6F, 3F, 0F); rightarm.setTextureSize(64, 64); rightarm.mirror = true; setRotation(rightarm, -1.301248F, 0F, 0F); leftarm = new ModelRenderer(this, 40, 46); leftarm.addBox(-1F, -2F, -2F, 5, 12, 5); leftarm.setRotationPoint(6F, 3F, 0F); leftarm.setTextureSize(64, 64); leftarm.mirror = true; setRotation(leftarm, -1.301248F, 0F, 0F); dot = new ModelRenderer(this, 1, 52); dot.addBox(0F, 0F, 0F, 8, 10, 1); dot.setRotationPoint(-3.5F, -7F, 0F); dot.setTextureSize(64, 64); dot.mirror = true; setRotation(dot, 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, entity); head.render(f5); body.render(f5); rightarm.render(f5); leftarm.render(f5); dot.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, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } RenderWraithMob.java(render class - yes, the directory for the texture is correct.) package bloopers.novelties.entity; import bloopers.novelties.Reference; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class RenderWraithMob extends RenderLiving { private static final ResourceLocation WraithTextures = new ResourceLocation("novelties:textures/entity/wraith/Wraith.png"); public RenderWraithMob(RenderManager rendermanagerIn, ModelBase modelbaseIn, float shadowsizeIn) { super(rendermanagerIn, modelbaseIn, shadowsizeIn); } protected ResourceLocation getEntityTexture(EntityWraithMob entity) { return WraithTextures; } protected ResourceLocation getEntityTexture(Entity entity) { return this.getEntityTexture((EntityWraithMob)entity); } } EntityCreate.java (my initialization thing for entity) package bloopers.novelties.entity; import bloopers.novelties.NoveltiesMod; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Biomes; import net.minecraftforge.fml.common.registry.EntityRegistry; public class EntityCreate { public static void mainRegistry() { registerEntity(); } public static void registerEntity() { createEntity(EntityWraithMob.class, "Wraith"); } public static void createEntity(Class entityClass, String entityName) { int randomId = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId); EntityRegistry.registerModEntity(entityClass, entityName, randomId, NoveltiesMod.modInstance, 64, 1, true); EntityRegistry.addSpawn(entityClass, 2, 0, 1, EnumCreatureType.MONSTER, Biomes.roofedForest); } }
May 17, 20169 yr Author What should I use instead? Update as in update my MDK? Found my texture problem - I'm just an idiot. First two questions I still need help with
May 17, 20169 yr Author What should I use instead?Nothing. Just registerModEntity . Update as in update my MDK?No, update as in change your code to use the new version. When removing the two lines saying "registerGlobalEntityID" and "findGlobalUniqueEntityIdD" how am I supposed to set the Entity ID now? When loading up the game the entity simply doesn't exist anymore - This is my EntityCreate class now: package bloopers.novelties.entity; import bloopers.novelties.NoveltiesMod; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Biomes; import net.minecraftforge.fml.common.registry.EntityRegistry; public class EntityCreate { public static void mainRegistry() { registerEntity(); } public static void registerEntity() { createEntity(EntityWraithMob.class, "Wraith"); } public static void createEntity(Class entityClass, String entityName) { EntityRegistry.registerModEntity(entityClass, entityName, 1, NoveltiesMod.modInstance, 64, 1, true); EntityRegistry.addSpawn(entityClass, 2, 0, 1, EnumCreatureType.MONSTER, Biomes.roofedForest); } }
May 18, 20169 yr Author When removing the two lines saying "registerGlobalEntityID" and "findGlobalUniqueEntityIdD" how am I supposed to set the Entity ID now?IDs for registerModEntity are local to your mod. Start at 0 and increment for every new entity. When loading up the game the entity simply doesn't exist anymoreWhat exactly do you mean by "it doesn't exist anymore"? The mob doesn't show up in /summon (i never created a spawn egg for it in the first place) and all of them that existed in the world before are now gone.
May 18, 20169 yr Author Well, the mod has a different internal ID now since you were using the deprecated methods before. The new ID has your ModID prefixed. Oh! Thanks a ton.
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.