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

 

  Reveal hidden contents

 

Tomboy

 

  Reveal hidden contents

 

TTSnim

 

  Reveal hidden contents

 

Posted
  On 3/30/2014 at 8:52 AM, diesieben07 said:

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

  Quote

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
  On 3/31/2014 at 8:58 PM, SureenInk said:

-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:

  Quote

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

  Quote

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

    • That is incorrect. Use the run.bat or run.sh to run the server.
    • Hello, I have been trying for days to create my server with forge-1.20.1-47.4.1-installer, which installs the server, but the forge-1.20.1-47.4.1.jar file, which is necessary to create the server, does not appear. I no longer know what to do. Help. hola buenas, llevo dias intentando poder hacer mi servidor con forge-1.20.1-47.4.1-installer el cual instalo el server, pero no aparece el archivo forge-1.20.1-47.4.1.jar , el cual es necesario para poder crear el server, ya no se que hacer ayuda.
    • Does this happen if you use the regular vanilla minecraft launcher? Also, unsure if TLauncher ever has a legit usage, as I have always seen it associated with software piracy, but if it has a legit mode, make sure it is using online mode so that it can authenticate your MS account to login. Aside from that, more information is likely needed. Post logs, as well as the paths you are placing files in (screenshots of your file explorer can be helpful as well).
    • I am using a third-party launcher that has pre-installed forge versions of Minecraft.  When I insert mods from CurseForge, I extract the files and as expected put them in the .mods folder. I am guessing that there is an error with the file transfer but I don't know for sure and sometimes I use Forge to test mods that I created before releasing previously on a different pc, so I don't know if it is the if it an extraction error but if are any tips or knowledge reply and I will read it. This is also will be kept on the forum for others that have the issues.
    • I make wires and i need connection 2 wires block. I have BooleanPropertys registered, but in mod loading it show Unknown the property in assets/wuntare/blockState. public static final BooleanProperty CONNECTED_NORTH = BooleanProperty.create("connected_north"); public static final BooleanProperty CONNECTED_SOUTH = BooleanProperty.create("connected_south"); public static final BooleanProperty CONNECTED_WEST = BooleanProperty.create("connected_west"); public static final BooleanProperty CONNECTED_EAST = BooleanProperty.create("connected_east"); public static final BooleanProperty CONNECTED_UP = BooleanProperty.create("connected_up"); public static final BooleanProperty CONNECTED_DOWN = BooleanProperty.create("connected_down"); public CopperWireWithoutInsulation0(Properties properties) { super(properties); this.registerDefaultState(this.stateDefinition.any() .setValue(CONNECTED_NORTH, false) .setValue(CONNECTED_SOUTH, false) .setValue(CONNECTED_WEST, false) .setValue(CONNECTED_EAST, false) .setValue(CONNECTED_UP, false) .setValue(CONNECTED_DOWN, false)); } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { builder.add(CONNECTED_NORTH, CONNECTED_SOUTH, CONNECTED_WEST, CONNECTED_EAST, CONNECTED_UP, CONNECTED_DOWN); } In this part blockState have problem "multipart": [ { "apply": { "model": "wuntare:block/copper_wire_without_insulation0" } }, { "when": { "connected_north": true }, "apply": { "model": "wuntare:block/copper_wire_without_insulation0_north" } },  
  • Topics

×
×
  • Create New...

Important Information

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