Jump to content

Recommended Posts

Posted

Doesn't seem to be an error with Neola. I tried using the same coding for both TTSnim and Tomboy, and commenting out everyone but one mob doesn't help. Whether it's Neola, Tomboy, or TTSnim, it still errors. Still, here's all three of them.

 

Neola

 

[code]package craftygirls.main;

import net.minecraft.block.BlockColored;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIAvoidEntity;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITargetNonTamed;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.world.World;

public class EntityNeola extends EntityTameable
{
    public EntityNeola(World par1World)
    {
        super(par1World);
        this.setSize(0.9F, 2F);
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
        this.tasks.addTask(2, this.aiSit);
        this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
        this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.apple, false));
        this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
        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));
        this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
        this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
        this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
        this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
        this.setTamed(false);
    }

    public boolean isAIEnabled() {
    	return true;
    }
    
    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D);
        if (this.isTamed()) {
            this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
        }
        else {
            this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
        }
    }

    protected void fall(float par1) {}
    
    @Override
    protected String getLivingSound()
    {
        return null;//this refers to:yourmod/sound/YourSound
    }

    @Override
    protected String getHurtSound()
    {
        return null;//this refers to:yourmod/sound/optionalFile/YourSound
    }

    @Override
    protected String getDeathSound()
    {
        return null;//etc.
    }

    @Override
    protected float getSoundVolume()
    {
        return 0.4F;
    }

public EntityNeola createChild(EntityAgeable par1EntityAgeable)
    {
        EntityNeola entityneola = new EntityNeola(this.worldObj);
        String s = this.getOwnerName();

        if (s != null && s.trim().length() > 0)
        {
            entityneola.setOwner(s);
            entityneola.setTamed(true);
        }

        return entityneola;
    }
public boolean isBreedingItem(ItemStack par1ItemStack)
    {
        return par1ItemStack != null && par1ItemStack.getItem() instanceof ItemSeeds;
    }

protected boolean canDespawn()
    {
        return false;
    }

public void setTamed(boolean par1)
    {
        super.setTamed(par1);

        if (par1)
        {
            this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
        }
        else
        {
            this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
        }
    }

protected Item getDropItem()
    {
        return Items.apple;
    }

    /**
     * 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);

        for (int k = 0; k < j; ++k)
        {
            this.dropItem(Items.apple, 1);
        }

        if (this.isBurning())
        {
            this.dropItem(Items.cooked_chicken, 1);
        }
        else
        {
            this.dropItem(Items.chicken, 1);
        }
    }
    
    public boolean canMateWith(EntityAnimal par1EntityAnimal)
    {
        if (par1EntityAnimal == this)
        {
            return false;
        }
        else if (!this.isTamed())
        {
            return false;
        }
        else if (!(par1EntityAnimal instanceof EntityNeola))
        {
            return false;
        }
        else
        {
            EntityNeola entityneola = (EntityNeola)par1EntityAnimal;
            return !entityneola.isTamed() ? false : (entityneola.isSitting() ? false : this.isInLove() && entityneola.isInLove());
        }
    }
    
    public boolean interact(EntityPlayer par1EntityPlayer)
    {
        ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();

        if (this.isTamed())
        {
            if (itemstack != null)
            {
                if (itemstack.getItem() instanceof ItemFood)
                {
                    ItemFood itemfood = (ItemFood)itemstack.getItem();

                    if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F)
                    {
                        if (!par1EntityPlayer.capabilities.isCreativeMode)
                        {
                            --itemstack.stackSize;
                        }

                        this.heal((float)itemfood.func_150905_g(itemstack));

                        if (itemstack.stackSize <= 0)
                        {
                            par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
                        }

                        return true;
                    }
                }
            }

            if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack))
            {
                this.aiSit.setSitting(!this.isSitting());
                this.isJumping = false;
                this.setPathToEntity((PathEntity)null);
                this.setTarget((Entity)null);
                this.setAttackTarget((EntityLivingBase)null);
            }
        }
        else if (itemstack != null && itemstack.getItem() == Items.apple)
        {
            if (!par1EntityPlayer.capabilities.isCreativeMode)
            {
                --itemstack.stackSize;
            }

            if (itemstack.stackSize <= 0)
            {
                par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
            }

            if (!this.worldObj.isRemote)
            {
                if (this.rand.nextInt(3) == 0)
                {
                    this.setTamed(true);
                    this.setPathToEntity((PathEntity)null);
                    this.setAttackTarget((EntityLivingBase)null);
                    this.aiSit.setSitting(true);
                    this.setHealth(100.0F);
                    this.setOwner(par1EntityPlayer.getCommandSenderName());
                    this.playTameEffect(true);
                    this.worldObj.setEntityState(this, (byte)7);
                }
                else
                {
                    this.playTameEffect(false);
                    this.worldObj.setEntityState(this, (byte)6);
                }
            }

            return true;
        }

        return super.interact(par1EntityPlayer);
    }
}

 

Tomboy

 

package craftygirls.main;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIAvoidEntity;
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.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class EntityTomboy extends EntityAnimal
{
    public EntityTomboy(World par1World)
    {
        super(par1World);
        this.setSize(0.9F, 2F);
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D));
        this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
        this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
        this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.cookie, false));
        this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
        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));
    }

    public boolean isAIEnabled() {
    	return true;
    }
    
    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D);
    }

    protected void fall(float par1) {}
    
    @Override
    protected String getLivingSound()
    {
        return null;//this refers to:yourmod/sound/YourSound
    }

    @Override
    protected String getHurtSound()
    {
        return null;//this refers to:yourmod/sound/optionalFile/YourSound
    }

    @Override
    protected String getDeathSound()
    {
        return null;//etc.
    }

    @Override
    protected float getSoundVolume()
    {
        return 0.4F;
    }

@Override
public EntityAgeable createChild(EntityAgeable var1) {
	return new EntityTomboy(this.worldObj);
}

public boolean isBreedingItem(ItemStack par1ItemStack)
    {
        return par1ItemStack != null && par1ItemStack.getItem() instanceof ItemSeeds;
    }

protected boolean canDespawn()
    {
        return false;
    }
}

 

TTSnim

 

package craftygirls.main;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIAvoidEntity;
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.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class EntityTTSnim extends EntityAnimal
{
    public EntityTTSnim(World par1World)
    {
        super(par1World);
        this.setSize(0.9F, 2F);
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D));
        this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
        this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
        this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.diamond, false));
        this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
        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));
    }

    public boolean isAIEnabled() {
    	return true;
    }
    
    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D);
    }

    protected void fall(float par1) {}
    
    @Override
    protected String getLivingSound()
    {
        return null;//this refers to:yourmod/sound/YourSound
    }

    @Override
    protected String getHurtSound()
    {
        return null;//this refers to:yourmod/sound/optionalFile/YourSound
    }

    @Override
    protected String getDeathSound()
    {
        return null;//etc.
    }

    @Override
    protected float getSoundVolume()
    {
        return 0.4F;
    }

@Override
public EntityAgeable createChild(EntityAgeable var1) {
	return new EntityTTSnim(this.worldObj);
}

public boolean isBreedingItem(ItemStack par1ItemStack)
    {
        return par1ItemStack != null && par1ItemStack.getItem() instanceof ItemSeeds;
    }

protected boolean canDespawn()
    {
        return false;
    }
}

 

Posted

The args probably changed from 1.6.4 to 1.7 and it was forgotten to change in EnumHelper.

 

The args changed even before there... There was a reason I didn't give him the addCreatureType method, though I probably should have said why. So again, use

private static final Class<?>[][] PARAM_TYPES = new Class[][] {{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}};
public static final EnumCreatureType MY_CREATURE_TYPE = EnumHelper.addEnum(PARAM_TYPES, EnumCreatureType.class, "creatureTypeName", BaseEntityClass.class, 40, Material.air, false, true);

instead of

public static final EnumCreatureType MY_CREATURE_TYPE = EnumHelper.addCreatureType(...)

since Forge doesn't provide the additional boolean parameter (even in 1.6) and thus will crash.

 

The parameters for the addEnum are as following:

par3 - "creatureTypeName" The name of the new enum within the EnumCreatureType class (you CANNOT use this to reference to the new enum directly! That's why the return value of the addEnum method is saved!)

par4 - BaseEntityClass.class The class which should be used as a reference (your mobs shall then use the same class or a childclass of it)

par5 - 40 Determines how much entites should be spawning at maximum

par6 - Material.air The Material the entities should be spawning in, Material.water and Material.air are used in vanilla

par7 - false Determines if it's a peaceful creature (e.g. any animal like cows, chickens etc.)

par8 - true Determines if it's an ambient creature (e.g. bats) an animal (e.g. see above)

 

In your case, it would be:

private static final Class<?>[][] PARAM_TYPES = new Class[][] {{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}};
public static final EnumCreatureType E_NEOLA = EnumHelper.addEnum(PARAM_TYPES, EnumCreatureType.class, "neola", WhateverYourCreatureClassIs.class, 40, Material.air, true, true);

Change those parameters to fit your purpose!

 

To reference it in the addSpawn method use the E_NEOLA variable

EntityRegistry.addSpawn(EntityNeola.class, 100, 8, 10, E_NEOLA, BiomeGenBase.forest);

 

Some notes from me:

  • I encourage that any static final variable is spelled uppercase with underscores separating the words, like MY_FINAL_VAR to distinguish them from normal variables
  • I encourage that any other variable is spelled camelCase, like myNormalVar

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

Well, the good news is that I don't have errors with the code anymore ^^ You've all been a big help there, and I thank you. The bad news is...I spent 20 minutes flying through 3 different worlds and still can't find a single one of them naturally spawning (I even created new worlds to see if that did anything). The spawn rates are 100, 8, 10...is that really low or something? I'd think a weighted probability of 100 would be really high and thus cause a lot of spawns...

Posted

Which biomes did you set them to spawn in? You might need to find such a biome and spend some time there looking around. I had a similar issue when horses were added, for I did not know they only spawned in plains and such.

Posted

I have them set for plains, forest, and Jungle. Whereas I've yet to see a jungle biome in any of my worlds, I spent about 20 minutes flying over plains and forest biomes and not seeing any spawns. I saw tons of horses, cows, pigs, sheep, etc. Like...lots more then I've ever seen...but none of my mobs showed. I will admit to having trouble finding spawns before with horses, and with a few other mods I used that had custom mobs in it...so I want to just trust that they are spawning...but I want to be sure...I don't want to release the mod if nothing is spawning, you know? Is there some kind of debug function I could use to test that it's working even if I don't see them spawning?

Posted

I went looking for the spawn code for different creatureTypes and I discovered the possible problem you are encountering getting your creatureType to spawn.

Check this code in BiomeGenBase:

    public List getSpawnableList(EnumCreatureType par1EnumCreatureType)
    {
        return par1EnumCreatureType == EnumCreatureType.monster ? this.spawnableMonsterList : (par1EnumCreatureType == EnumCreatureType.creature ? this.spawnableCreatureList : (par1EnumCreatureType == EnumCreatureType.waterCreature ? this.spawnableWaterCreatureList : (par1EnumCreatureType == EnumCreatureType.ambient ? this.spawnableCaveCreatureList : null)));
    }

Apparently it is not smart enough to support spawning custom CreatureTypes. This makes is hard to accomplish what you want short of using ASM and changing the method. On the other hand, if you used a standard creature type from the list then it should spawn nicely.

Posted

Wow...that sucks...so is it impossible, then, for me to add Tameable creatures without using ASM? (I don't even know what ASM is x.x) Or can I just use like...the standard creature and still make it tameable?

Posted

@sequituri: Certainly didn't expect the code to be so inflexible... I wonder how Mo' Creatures does it?

 

@OP: You can use the vanilla creature types just fine for custom entities provided your entity matches the type (i.e. Mob, Animal / Creature, Ambient, WaterCreature). Note that you will be competing with all mobs that use the same creature types, so for testing you should definitely set your spawn rate to 1000+ just so you can see them spawn.

 

I haven't done much with entity spawning, but Ambient creatures are almost nonexistant in vanilla minecraft, so if you can code your entity to be an ambient creature type and still get the tameable functionality, you won't have much to compete against - but it's more work >.<

Posted

-sighs- nope, that didn't work either...I even tried setting them to spawn in the desert, where nothing else spawns, and still got nothing... I really don't understand what's wrong here v.v

 

EDIT: NO WAIT! I got one of the three to spawn! I think I may have figured out why they weren't spawning!

 

EDIT 2: Okay, still can't get the other version of the code to spawn them (the one SanAndreasP gave me) but I can get them to spawn with the regular code now. So, I'll leave that up to SAP if he wants to try to fix it further. Here's my code for the main:

package craftygirls.main;

import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import net.minecraft.entity.EntityList.EntityEggInfo;
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.registry.EntityRegistry;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraft.entity.passive.EntityTameable;

@Mod(modid = "craftygirls", name = "The Crafty Girls Core Mod", version = "Alpha v0.1")
public class Main {

@Instance("craftygirls")
public static Main instance;

//Proxies
@SidedProxy(clientSide="craftygirls.main.ClientProxyClass", serverSide="craftygirls.main.CommonProxyClass")
public static CommonProxyClass proxy;

private static final Class[][] paramTypes = new Class<?>[][] {{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}};
public static final EnumCreatureType EnumNeola = EnumHelper.addEnum(paramTypes, EnumCreatureType.class, "TypeNeola", EntityNeola.class, 40, Material.air, true, true);
public static final EnumCreatureType EnumTomBoy = EnumHelper.addEnum(paramTypes, EnumCreatureType.class, "TypeTomBoy", EntityTomboy.class, 40, Material.air, true, true);
public static final EnumCreatureType EnumTTSnim = EnumHelper.addEnum(paramTypes, EnumCreatureType.class, "TypeTTSnim", EntityTTSnim.class, 40, Material.air, true, true);
//Cookies for Tomboy. Flowers for Alice, and Diamonds for Stef

@EventHandler
public void preInit(FMLPreInitializationEvent e){

}

@EventHandler
public void Init(FMLInitializationEvent e) {

	short entityID = 0;
	proxy.registerEntityWithEgg(EntityNeola.class, "Neola", entityID++, this, 128, 1, true, 0x492d00, 0x029820);
	proxy.registerEntityWithEgg(EntityTomboy.class, "TomBoy", entityID++, this, 128, 1, true, 0x290877, 0x03f63b);
	proxy.registerEntityWithEgg(EntityTTSnim.class, "TTSnim", entityID++, this, 128, 1, true, 0x8e69cd, 0xfee02b);
	proxy.registerRenderThings();	

	}

public void postInit(FMLPostInitializationEvent e) {

	EntityRegistry.addSpawn(EntityNeola.class, 1000, 8, 10, EnumNeola, BiomeGenBase.forest);
	EntityRegistry.addSpawn(EntityTomboy.class, 1000, 8, 10, EnumTomBoy, BiomeGenBase.jungle);
	EntityRegistry.addSpawn(EntityTTSnim.class, 1000, 8, 10, EnumTTSnim, BiomeGenBase.plains);

}
}

And, no, I'm not getting any errors with it, I'm just not getting any spawns from it.

Posted

-sighs- nope, that didn't work either...I even tried setting them to spawn in the desert, where nothing else spawns, and still got nothing... I really don't understand what's wrong here v.v

 

EDIT: NO WAIT! I got one of the three to spawn! I think I may have figured out why they weren't spawning!

 

EDIT 2: Okay, still can't get the other version of the code to spawn them (the one SanAndreasP gave me) but I can get them to spawn with the regular code now. So, I'll leave that up to SAP if he wants to try to fix it further. Here's my code for the main:

package craftygirls.main;

import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import net.minecraft.entity.EntityList.EntityEggInfo;
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.registry.EntityRegistry;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraft.entity.passive.EntityTameable;

@Mod(modid = "craftygirls", name = "The Crafty Girls Core Mod", version = "Alpha v0.1")
public class Main {

@Instance("craftygirls")
public static Main instance;

//Proxies
@SidedProxy(clientSide="craftygirls.main.ClientProxyClass", serverSide="craftygirls.main.CommonProxyClass")
public static CommonProxyClass proxy;

private static final Class[][] paramTypes = new Class<?>[][] {{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}};
public static final EnumCreatureType EnumNeola = EnumHelper.addEnum(paramTypes, EnumCreatureType.class, "TypeNeola", EntityNeola.class, 40, Material.air, true, true);
public static final EnumCreatureType EnumTomBoy = EnumHelper.addEnum(paramTypes, EnumCreatureType.class, "TypeTomBoy", EntityTomboy.class, 40, Material.air, true, true);
public static final EnumCreatureType EnumTTSnim = EnumHelper.addEnum(paramTypes, EnumCreatureType.class, "TypeTTSnim", EntityTTSnim.class, 40, Material.air, true, true);
//Cookies for Tomboy. Flowers for Alice, and Diamonds for Stef

@EventHandler
public void preInit(FMLPreInitializationEvent e){

}

@EventHandler
public void Init(FMLInitializationEvent e) {

	short entityID = 0;
	proxy.registerEntityWithEgg(EntityNeola.class, "Neola", entityID++, this, 128, 1, true, 0x492d00, 0x029820);
	proxy.registerEntityWithEgg(EntityTomboy.class, "TomBoy", entityID++, this, 128, 1, true, 0x290877, 0x03f63b);
	proxy.registerEntityWithEgg(EntityTTSnim.class, "TTSnim", entityID++, this, 128, 1, true, 0x8e69cd, 0xfee02b);
	proxy.registerRenderThings();	

	}

public void postInit(FMLPostInitializationEvent e) {

	EntityRegistry.addSpawn(EntityNeola.class, 1000, 8, 10, EnumNeola, BiomeGenBase.forest);
	EntityRegistry.addSpawn(EntityTomboy.class, 1000, 8, 10, EnumTomBoy, BiomeGenBase.jungle);
	EntityRegistry.addSpawn(EntityTTSnim.class, 1000, 8, 10, EnumTTSnim, BiomeGenBase.plains);

}
}

And, no, I'm not getting any errors with it, I'm just not getting any spawns from it.

 

There's nothing I can do to fix this. It's an issue with the Minecraft code itself:

I went looking for the spawn code for different creatureTypes and I discovered the possible problem you are encountering getting your creatureType to spawn.

Check this code in BiomeGenBase:

    public List getSpawnableList(EnumCreatureType par1EnumCreatureType)
    {
        return par1EnumCreatureType == EnumCreatureType.monster ? this.spawnableMonsterList : (par1EnumCreatureType == EnumCreatureType.creature ? this.spawnableCreatureList : (par1EnumCreatureType == EnumCreatureType.waterCreature ? this.spawnableWaterCreatureList : (par1EnumCreatureType == EnumCreatureType.ambient ? this.spawnableCaveCreatureList : null)));
    }

Apparently it is not smart enough to support spawning custom CreatureTypes. This makes is hard to accomplish what you want short of using ASM and changing the method. On the other hand, if you used a standard creature type from the list then it should spawn nicely.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

Ahh, all right then, I wasn't sure. Well, then, I guess that's about all I can do with it...I mean, unless somsone wants to tell me how to go about overriding the minecraft code and all, and I don't know if I'm really experienced enough for that yet so. Thanks everyone for the help. ^^

Posted

I just found this, so it may already have been tried and failed...

There is a MinecraftForge event called

WorldEvent.PotentialSpawns

that can be handled and will allow the spawnlist to be set to any spawnlist desired (added to, or removed from). That might make your creature spawn wherever you want. I have not tested this theory, so it's up to you.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.