Posted June 30, 20178 yr Hi All, Trying to get an animal called a Brian to spawn in my mod. I've been working on 1.11 and set my mod up based on MrCrayfish and Mcjty's tutorials. I followed their setup and have created the mob (as guided by Mcjty) and it's not spawning and there is no egg appearing in the misc tab in Creative Mode. I'm not sure what I've done wrong here. Here's my EntityBrian.java code: package org.educraft.brianface.entityclasses; import net.minecraft.block.Block; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.*; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Biomes; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.datafix.DataFixer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.EntityRegistry; import org.educraft.brianface.Reference; import org.educraft.brianface.init.ModItems; import javax.annotation.Nullable; public class EntityBrian extends EntityAnimal { public static final ResourceLocation LOOT = new ResourceLocation(Reference.MOD_ID, "entities/brian"); public EntityBrian(World worldIn) { super(worldIn); this.setSize(0.6F, 1.95F); } public static void registerFixesBrian(DataFixer fixer) { EntityLiving.registerFixesMob(fixer, EntityBrian.class); } @Override protected void entityInit() { super.entityInit(); } @Override protected void initEntityAI() { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(3, new EntityAITempt(this, 1.0D, ModItems.brapple, false)); this.tasks.addTask(4, new EntityAIPanic(this, 2.0D)); this.tasks.addTask(5, new EntityAIMate(this, 1.0D)); this.tasks.addTask(7, new EntityAIFollowParent(this, 1.25D)); this.tasks.addTask(8, new EntityAIWanderAvoidWater(this, 1.0D)); this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(10, new EntityAILookIdle(this)); this.applyEntityAI(); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(5.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(1.0D); } private void applyEntityAI() { this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, true)); } public static void RegisterEntity() { //EntityRegistry.registerModEntity(EntityBrian.class, "Brian", EntityBrian.getEntityId(), Main.instance); EntityRegistry.addSpawn(EntityBrian.class, 25, 1, 5, EnumCreatureType.CREATURE, Biomes.FOREST); } protected void playStepSound(BlockPos pos, Block blockIn) { this.playSound(SoundEvents.BLOCK_ANVIL_STEP, 0.15F, 1.0F); } protected float getSoundVolume() { return 0.2F; } World worldIn; EntityPlayer playerIn; public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack itemstack = player.getHeldItem(hand); EntityBrian entity; if (itemstack.getItem() == ModItems.brapple && !player.capabilities.isCreativeMode) { itemstack.shrink(1); EntityItem brian_poo = new EntityItem(worldIn, playerIn.posX, playerIn.posY, playerIn.posZ, new ItemStack(ModItems.brian_poo)); return true; } else { return super.processInteract(player, hand); } } public EntityBrian createChild(EntityAgeable ageable) { return new EntityBrian(this.world); } public float getEyeHeight() { return this.isChild() ? this.height : 0.6F; } @Override @Nullable protected ResourceLocation getLootTable(){ return LOOT; } @Override public int getMaxSpawnedInChunk(){ return 8; } } Here's my ModelBrian.java code: package org.educraft.brianface.modelclasses; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; /** * Created by admiralmattbar on 5/14/2017. */ // Date: 5/14/2017 3:28:20 PM // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX public class ModelBrian extends ModelBase { //fields ModelRenderer head; ModelRenderer body; ModelRenderer rightarm; ModelRenderer leftarm; ModelRenderer rightleg; ModelRenderer leftleg; public ModelBrian() { textureWidth = 64; textureHeight = 32; head = new ModelRenderer(this, 0, 0); head.addBox(-4F, -8F, -4F, 8, 8, 8); head.setRotationPoint(0F, 0F, 0F); head.setTextureSize(64, 32); head.mirror = true; setRotation(head, 0F, 0F, 0F); body = new ModelRenderer(this, 16, 16); body.addBox(-4F, 0F, -2F, 8, 12, 4); body.setRotationPoint(0F, 0F, 0F); body.setTextureSize(64, 32); body.mirror = true; setRotation(body, 0F, 0F, 0F); rightarm = new ModelRenderer(this, 40, 16); rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); rightarm.setRotationPoint(-5F, 2F, 0F); rightarm.setTextureSize(64, 32); rightarm.mirror = true; setRotation(rightarm, 0F, 0F, 0F); leftarm = new ModelRenderer(this, 40, 16); leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); leftarm.setRotationPoint(5F, 2F, 0F); leftarm.setTextureSize(64, 32); leftarm.mirror = true; setRotation(leftarm, 0F, 0F, 0F); rightleg = new ModelRenderer(this, 0, 16); rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); rightleg.setRotationPoint(-2F, 12F, 0F); rightleg.setTextureSize(64, 32); rightleg.mirror = true; setRotation(rightleg, 0F, 0F, 0F); leftleg = new ModelRenderer(this, 0, 16); leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); leftleg.setRotationPoint(2F, 12F, 0F); leftleg.setTextureSize(64, 32); leftleg.mirror = true; setRotation(leftleg, 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); body.render(f5); rightarm.render(f5); leftarm.render(f5); rightleg.render(f5); leftleg.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 limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); } } Here's my RenderBrian.java code package org.educraft.brianface.renderer.entity; import jdk.nashorn.internal.runtime.regexp.JoniRegExp; import net.minecraft.client.model.ModelCow; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.passive.EntityCow; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.educraft.brianface.entityclasses.EntityBrian; import org.educraft.brianface.modelclasses.ModelBrian; import javax.annotation.Nonnull; import javax.annotation.Nullable; @SideOnly(Side.CLIENT) public class RenderBrian extends RenderLiving<EntityBrian> { private ResourceLocation BRIAN_TEXTURE = new ResourceLocation("bm:textures/entity/brian/brian.png"); public static final Factory FACTORY = new Factory(); public RenderBrian(RenderManager rendermanagerIn) { super(rendermanagerIn, new ModelBrian(), 0.5F); } @Nullable @Override protected ResourceLocation getEntityTexture(@Nonnull EntityBrian enttiy) { return BRIAN_TEXTURE; } public static class Factory implements IRenderFactory<EntityBrian> { @Override public Render<? super EntityBrian> createRenderFor(RenderManager manager) { return new RenderBrian(manager); } } } Here's my ModEntities.java code: package org.educraft.brianface.entityclasses; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Biomes; import net.minecraft.util.ResourceLocation; import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.educraft.brianface.Main; import org.educraft.brianface.Reference; import org.educraft.brianface.renderer.entity.RenderBrian; public class ModEntities { public static void init(){ //Mod ID numbers int id = 1; EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "brian"), EntityBrian.class, "Brian", id++, Main.instance, 64, 3, true, 0xfaf77f, 0x2dd1f1); EntityRegistry.addSpawn(EntityBrian.class, 100, 3, 5, EnumCreatureType.CREATURE, Biomes.PLAINS, Biomes.ICE_PLAINS, Biomes.FOREST, Biomes.FOREST_HILLS); LootTableList.register(EntityBrian.LOOT); } @SideOnly(Side.CLIENT) public static void initModels() { RenderingRegistry.registerEntityRenderingHandler(EntityBrian.class, RenderBrian.FACTORY); } } And here's my json file for the loot table under assets.brianface.loot_tables.entities { "pools": [ { "name": "brianface:brian", "rolls": 1, "entries": [ { "type": "item", "name": "brianface:brapple", "weight": 1, "functions": [ { "function": "set_count", "count": { "min": 0, "max": 2 } }, { "function": "looting_enchant", "count": { "min": 0, "max": 1 } } ] } ] }, { "name": "brianface:brian", "conditions": [ { "condition": "killed_by_player" }, { "condition": "random_chance_with_looting", "chance": 0.05, "looting_multiplier": 0.01 } ], "rolls": 1, "entries": [ { "type": "item", "name": "brianface:raw_brian", "weight": 1 } ] } ] } I'm trying real hard here to find out what I did wrong. I run the initModels() class from ModEntities in the CommonProxy class as well. Any help would be appreciated.
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.