Alright, I've created the Turkey entity, made a model for it, rendered said model, and even registered said entity and added its spawn (it's fairly rare and only spawns in forests). However, it will not spawn, neither naturally nor by spawn egg. Code is below:
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
proxy.preInit(e);
ModBlocks.init();
ModItems.init();
registerModEntityWithEgg(EntityTurkey.class, "Turkey", 0x3F5505, 0x4E6414);
}
private void registerModEntityWithEgg(Class parEntityClass, String parEntityName,
int parEggColor, int parEggSpotsColor)
{
EntityRegistry.registerModEntity(parEntityClass, parEntityName, ++modEntityID,
ThanksgivingMod.instance, 80, 3, false);
EntityRegistry.addSpawn(EntityTurkey.class, 6, 1, 5, EnumCreatureType.creature,
BiomeGenBase.forest);
createEgg(EntityTurkey.class, 1, 0x5651507, 0x16711680);
}
private static void createEgg(Class entityClass, int i, int solidColour, int spotColour) {
EntityList.entityEggs.put(Integer.valueOf(i), new EntityList.EntityEggInfo(i, spotColour, solidColour));
}
package com.lastdovahkiin.thanksgivingmod.entity;
import com.lastdovahkiin.thanksgivingmod.items.ModItems;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityTurkey extends EntityAnimal {
public EntityTurkey(World world) {
super(world);
setSize(1.0F, 1.0F);
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(12.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
}
protected String getLivingSound()
{
return "turkeysay";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "turkeyhurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "turkeyhurt";
}
protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_)
{
this.playSound("mob.chicken.step", 0.15F, 1.0F);
}
/**
* 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 p_70628_1_, int p_70628_2_)
{
int j = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_);
for (int k = 0; k < j; ++k)
{
this.dropItem(ModItems.turkeyfeather, 1);
}
{
this.dropItem(ModItems.rawturkey, 1);
}
}
@Override
public EntityTurkey createChild(EntityAgeable ageable)
{
return new EntityTurkey(this.worldObj);
}
/**
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
* the animal type)
*/
public boolean isBreedingItem(ItemStack p_70877_1_)
{
return p_70877_1_ != null && p_70877_1_.getItem() instanceof ItemSeeds;
}
}
Rollback Post to RevisionRollBack
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
Post your client class code. Post your render. I think maybe you didn't register the rendering of the entity properly. I think the mobs spawn you just can't see it.
How do you know it is not Spawning?Did you test it?
if not
Try to test a little more by outputing to the log. Figure out if the entity is spawning and not rendering(most likely case). eg output xyz of entity location and see if it moves or walks.
Post your client class code. Post your render. I think maybe you didn't register the rendering of the entity properly. I think the mobs spawn you just can't see it.
How do you know it is not Spawning?Did you test it?
if not
Try to test a little more by outputing to the log. Figure out if the entity is spawning and not rendering(most likely case). eg output xyz of entity location and see if it moves or walks.
My clientproxy code is below:
package com.lastdovahkiin.thanksgivingmod;
import com.lastdovahkiin.thanksgivingmod.entity.EntityTurkey;
import com.lastdovahkiin.thanksgivingmod.models.ModelTurkey;
import com.lastdovahkiin.thanksgivingmod.renderer.RenderTurkey;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
public class ClientProxy extends CommonProxy
{
public void registerRenderThings()
{
RenderingRegistry.registerEntityRenderingHandler(EntityTurkey.class, new RenderTurkey(new ModelTurkey(), 0.5F));
}
public void registerSounds()
{
}
@Override
public void preInit(FMLPreInitializationEvent e) {
// TODO Auto-generated method stub
super.preInit(e);
}
@Override
public void init(FMLInitializationEvent e) {
// TODO Auto-generated method stub
super.init(e);
}
@Override
public void postInit(FMLPostInitializationEvent e) {
// TODO Auto-generated method stub
super.postInit(e);
}
}
Rollback Post to RevisionRollBack
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
I am getting confused in the first post you said it doesn't spawn via spawn eggs. Now you are saying you can spawn via spawn eggs but not manually (what does manually mean if not spawn eggs?)
Rollback Post to RevisionRollBack
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
I am getting confused in the first post you said it doesn't spawn via spawn eggs. Now you are saying you can spawn via spawn eggs but not manually (what does manually mean if not spawn eggs?)
Whoops, sorry, I meant naturally.
Rollback Post to RevisionRollBack
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
Maybe it is spawning you are not seeing it or the chance are too low like you said "(it's fairly rare and only spawns in forests)". There a couple ways to test this.
For testing purposes change the frequency to a higher number and make sure you are in a forest. Add a system.out in your turkey constructor to see if it is being called.
Rollback Post to RevisionRollBack
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Maybe it is spawning you are not seeing it or the chance are too low like you said "(it's fairly rare and only spawns in forests)". There a couple ways to test this.
For testing purposes change the frequency to a higher number and make sure you are in a forest. Add a system.out in your turkey constructor to see if it is being called.
Still no natural spawns, but the method is being called. I just don't get it.
Rollback Post to RevisionRollBack
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
ok print out the x y z of them and see if they are there. Also how often is the method called (how many spawn)?
print the x y z in the onUpdate method override it make sure to call super.onUpdate(); in it though.
Create a new world so the ones you manually spawned don't interfere with the test.
@Override
public void onUpdate() {
System.out.println("X:"+this.posX+" Y:"+this.posY+" Z:"+this.posZ);
super.onUpdate();
}
If the constructor gets called then it mean they spawned
Nvm, went to the coordinates mentioned in the console, and found 'em. The only problem now, they drop items that I haven't even registered yet. Normally that would mean a crash, but it didn't crash.
You have it in your code to drop items. They are probably missing textures.
Yeah, not only that, but I haven't even registered those items yet, although they are initialized. If I register the items, will they have textures?
I believe (from personal experience)that if a mob dies and drops items that don't exist, they still drop, just with a missing texture.
Edit: Ok, the items are registered and are now textured. I love my turkey, though I might change the model later on (the current model is a really fat chicken).
Alright, I've created the Turkey entity, made a model for it, rendered said model, and even registered said entity and added its spawn (it's fairly rare and only spawns in forests). However, it will not spawn, neither naturally nor by spawn egg. Code is below:
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
Post your client class code. Post your render. I think maybe you didn't register the rendering of the entity properly. I think the mobs spawn you just can't see it.
How do you know it is not Spawning?Did you test it?
if not
Try to test a little more by outputing to the log. Figure out if the entity is spawning and not rendering(most likely case). eg output xyz of entity location and see if it moves or walks.
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Portfolio
TempTorch BabyAnimal MiningTNT SnowBallDamage EnderAdvancement HydratedFarms
My clientproxy code is below:
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
Does the method
override from common?
if not try to
just add this in your client preinit
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Portfolio
TempTorch BabyAnimal MiningTNT SnowBallDamage EnderAdvancement HydratedFarms
CommonProxy.java:
Oh, forgot to mention, it doesn't spawn naturally or by spawn egg, only with the /summon command.
RenderTurkey.java:
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
So when you use summon it renders and moves and all the other ai stuff.
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Portfolio
TempTorch BabyAnimal MiningTNT SnowBallDamage EnderAdvancement HydratedFarms
Yes. I managed to get it to spawn via spawn egg, but it will not spawn naturally. I even tried adding the method below, which didn't work:
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
I am getting confused in the first post you said it doesn't spawn via spawn eggs. Now you are saying you can spawn via spawn eggs but not manually (what does manually mean if not spawn eggs?)
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Portfolio
TempTorch BabyAnimal MiningTNT SnowBallDamage EnderAdvancement HydratedFarms
Whoops, sorry, I meant naturally.
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
Maybe it is spawning you are not seeing it or the chance are too low like you said "(it's fairly rare and only spawns in forests)". There a couple ways to test this.
For testing purposes change the frequency to a higher number and make sure you are in a forest. Add a system.out in your turkey constructor to see if it is being called.
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Portfolio
TempTorch BabyAnimal MiningTNT SnowBallDamage EnderAdvancement HydratedFarms
Still no natural spawns, but the method is being called. I just don't get it.
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
ok print out the x y z of them and see if they are there. Also how often is the method called (how many spawn)?
print the x y z in the onUpdate method override it make sure to call super.onUpdate(); in it though.
Create a new world so the ones you manually spawned don't interfere with the test.
If the constructor gets called then it mean they spawned
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Portfolio
TempTorch BabyAnimal MiningTNT SnowBallDamage EnderAdvancement HydratedFarms
Nvm, went to the coordinates mentioned in the console, and found 'em. The only problem now, they drop items that I haven't even registered yet. Normally that would mean a crash, but it didn't crash.
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
Did you do like I asked: create a new world, go to forest, look at console for location and walk there check if they are there.OP changed previous post i was referring to.
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Portfolio
TempTorch BabyAnimal MiningTNT SnowBallDamage EnderAdvancement HydratedFarms
Edited my previous post. Found em, now the only issue is with the dropped items.
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
You have it in your code to drop items. They are probably missing textures.
I am starting do small simple mod request. If the mod can be made in an hour I will do it for you.
Portfolio
TempTorch BabyAnimal MiningTNT SnowBallDamage EnderAdvancement HydratedFarms
Yeah, not only that, but I haven't even registered those items yet, although they are initialized. If I register the items, will they have textures?
I believe (from personal experience)that if a mob dies and drops items that don't exist, they still drop, just with a missing texture.
Edit: Ok, the items are registered and are now textured. I love my turkey, though I might change the model later on (the current model is a really fat chicken).
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...