Jump to content

[1.8] Multiple Custom Entities


Snipehawk

Recommended Posts

Hello,

I am making a mod for Minecraft 1.8 and am wondering why I cannot create multiple mobs using my method..

The problem is that in my common proxy only the first "Entity Creator" is being read/used (Only Spartan Soldier is implemented into game but when order is switched around only Samurai is being implemented)

 

Here is my Common Proxy:

 

 

 

package adamisaac.empiresmod.proxy;

 

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import adamisaac.empiresmod.EntityCreator;

import adamisaac.empiresmod.empireEntity.EntitySamurai;

import adamisaac.empiresmod.empireEntity.EntitySpartanSoldier;

import adamisaac.empiresmod.empireRender.RenderSamurai;

import adamisaac.empiresmod.empireRender.RenderSpartanSoldier;

import adamisaac.empiresmod.init.EmpiresModItems;

 

public class CommonProxy  {

public void preInit(FMLPreInitializationEvent e) {

 

EmpiresModItems.createItems();

 

//ModBlocks.createBlocks();

}

 

public void init(FMLInitializationEvent e) {

 

 

 

EntityCreator.createMob(EntitySpartanSoldier.class, new RenderSpartanSoldier(), "SpartanSoldier", EnumCreatureType.MONSTER, 10, 0, 5, new BiomeGenBase[] {BiomeGenBase.desert}, 0xFF00FB, 0xD69D00, true);

EntityCreator.createMob(EntitySamurai.class, new RenderSamurai(), "Samurai", EnumCreatureType.MONSTER, 10, 0, 5, new BiomeGenBase[] {BiomeGenBase.desert}, 0xFF00FB, 0xD69D00, true);

 

//ModCrafting.initCrafting();

;

}

 

public void postInit(FMLPostInitializationEvent e) {

 

}

}

 

 

 

Here is my method class:

 

 

 

package adamisaac.empiresmod;

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.entity.EntityList;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraftforge.fml.client.registry.RenderingRegistry;

import net.minecraftforge.fml.common.registry.EntityRegistry;

public class EntityCreator {

 

public static void createMob(Class entityClass, Render render, String entityName, EnumCreatureType type, int probability, int minSpawn, int maxSpawn, BiomeGenBase [] biomes, int solidColor, int spotColor, boolean hasSpawnEgg){

int id = EntityRegistry.findGlobalUniqueEntityId();

EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);

EntityRegistry.registerModEntity(entityClass, entityName, solidColor, EmpiresMod.instance, 64, 1, true);

EntityRegistry.addSpawn(entityName, probability, minSpawn, maxSpawn, type, biomes);

RenderingRegistry.registerEntityRenderingHandler(entityClass, render);

 

if (hasSpawnEgg) {

EntityList.entityEggs.put(Integer.valueOf(id), new EntityList.EntityEggInfo(id, solidColor, spotColor));

}

 

 

}

}

 

 

 

Any help would be appreciated!

Link to comment
Share on other sites

Right, had it in the main class before, but wasn't working so I decided to throw it in my Proxy in desperation  :-\

 

It is in my main class now, but still isn't working.. Any ideas?

 

 

 

package adamisaac.empiresmod;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.ItemModelMesher;

import net.minecraft.client.resources.model.ModelBakery;

import net.minecraft.client.resources.model.ModelResourceLocation;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.item.Item;

import net.minecraft.item.Item.ToolMaterial;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.Mod.Instance;

import net.minecraftforge.fml.common.SidedProxy;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import net.minecraftforge.fml.common.registry.GameRegistry;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

import adamisaac.empiresmod.empireEntity.EntitySamurai;

import adamisaac.empiresmod.empireEntity.EntitySpartanSoldier;

import adamisaac.empiresmod.empireRender.RenderSamurai;

import adamisaac.empiresmod.empireRender.RenderSpartanSoldier;

import adamisaac.empiresmod.init.EmpireBow;

import adamisaac.empiresmod.init.EmpiresModItems;

import adamisaac.empiresmod.proxy.CommonProxy;

 

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)

public class EmpiresMod {

 

public static final String MODID = "ep";

public static final String MODNAME = "Empires Mod";

public static final String VERSION = "1.0.0";

 

@Instance

public static EmpiresMod instance = new EmpiresMod();

 

 

@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)

public static CommonProxy proxy;

 

public static final EmpiresModTab tabEmpiresMod = new EmpiresModTab("tabEmpiresMod");

public static EmpiresMod modInstance;

 

 

@EventHandler

public void preInit(FMLPreInitializationEvent e) {

proxy.preInit(e);

 

}

 

    @EventHandler

    public void preLoad(FMLPreInitializationEvent event)

    {

        EmpiresModItems.egyptianBow = new EmpireBow().setUnlocalizedName("egyptianBow");

        GameRegistry.registerItem(EmpiresModItems.egyptianBow, "egyptianBow_standby");

     

    }

   

    @EventHandler

    public void load(FMLInitializationEvent event)

    {

   

   

        if(event.getSide().isClient())

        {

        ModelBakery.addVariantName(EmpiresModItems.egyptianBow, new String[] {"ep:textures/items/egyptianBow_standby.png", "ep:textures/items/egyptianBow_pulling_0.png", "ep:textures/items/egyptianBow_pulling_1.png", "ep:textures/items/egyptianBow_pulling_2.png"});

 

            registerItem(EmpiresModItems.egyptianBow, 0, "ep:textures/items/egyptianBow_standby.png");

            registerItem(EmpiresModItems.egyptianBow, 1, "ep:textures/items/egyptianBow_pulling_0.png");

            registerItem(EmpiresModItems.egyptianBow, 2, "ep:textures/items/egyptianBow_pulling_1.png");

            registerItem(EmpiresModItems.egyptianBow, 3, "ep:textures/items/egyptianBow_pulling_2.png");

        }

    }

 

    @SideOnly(Side.CLIENT)

    public static void registerItem(Item item, int metadata, String itemName)

    {

        ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

        mesher.register(item, metadata, new ModelResourceLocation(itemName, "inventory"));

    }

// TODO Auto-generated method stub

 

 

 

@EventHandler

public void init(FMLInitializationEvent e) {

EntityCreator.createMob(EntitySpartanSoldier.class, new RenderSpartanSoldier(), "SpartanSoldier", EnumCreatureType.MONSTER, 10, 0, 5, new BiomeGenBase[] {BiomeGenBase.desert}, 0xFF00FB, 0xD69D00, true);

EntityCreator.createMob(EntitySamurai.class, new RenderSamurai(), "Samurai", EnumCreatureType.MONSTER, 10, 0, 5, new BiomeGenBase[] {BiomeGenBase.desert}, 0xFF00FB, 0xD69D00, true);

proxy.init(e);

 

 

 

 

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent e) {

proxy.postInit(e);

}

}

 

 

 

 

 

Link to comment
Share on other sites

Remove the events from your proxies.

@EventHandler
   public void preInit(FMLPreInitializationEvent e) {
      proxy.preInit(e);
      
   }

 

What belongs in your proxies is this

if(event.getSide().isClient())
        {
            ModelBakery.addVariantName(EmpiresModItems.egyptianBow, new String[] {"ep:textures/items/egyptianBow_standby.png", "ep:textures/items/egyptianBow_pulling_0.png", "ep:textures/items/egyptianBow_pulling_1.png", "ep:textures/items/egyptianBow_pulling_2.png"});

             registerItem(EmpiresModItems.egyptianBow, 0, "ep:textures/items/egyptianBow_standby.png");
             registerItem(EmpiresModItems.egyptianBow, 1, "ep:textures/items/egyptianBow_pulling_0.png");
             registerItem(EmpiresModItems.egyptianBow, 2, "ep:textures/items/egyptianBow_pulling_1.png");
             registerItem(EmpiresModItems.egyptianBow, 3, "ep:textures/items/egyptianBow_pulling_2.png");
        }

Read a tutorial how and why to use proxies. After thats cleaned up move back to entities

 

Link to comment
Share on other sites

Thank you for your responses, I had already removed the events from my proxy, and okay thank you for the bow section. I am working on this mod with a friend and he created all the proxies/ has a good understanding of them. I got him to clean everything up so now our main class is pretty clean but neither of us know why it is only creating one of the two mobs..

 

Main Class:

 

 

package adamisaac.empiresmod;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.ItemModelMesher;

import net.minecraft.client.resources.model.ModelBakery;

import net.minecraft.client.resources.model.ModelResourceLocation;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.item.Item;

import net.minecraft.item.Item.ToolMaterial;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.Mod.Instance;

import net.minecraftforge.fml.common.SidedProxy;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import net.minecraftforge.fml.common.registry.GameRegistry;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

import adamisaac.empiresmod.empireEntity.EntitySamurai;

import adamisaac.empiresmod.empireEntity.EntitySpartanSoldier;

import adamisaac.empiresmod.empireRender.RenderSamurai;

import adamisaac.empiresmod.empireRender.RenderSpartanSoldier;

import adamisaac.empiresmod.init.EmpireBow;

import adamisaac.empiresmod.init.EmpiresModItems;

import adamisaac.empiresmod.proxy.CommonProxy;

 

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)

public class EmpiresMod {

 

public static final String MODID = "ep";

public static final String MODNAME = "Empires Mod";

public static final String VERSION = "1.0.0";

 

@Instance

public static EmpiresMod instance = new EmpiresMod();

 

 

@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)

public static CommonProxy proxy;

 

public static final EmpiresModTab tabEmpiresMod = new EmpiresModTab("tabEmpiresMod");

    //public static EmpiresMod modInstance;

 

 

@EventHandler

public void preInit(FMLPreInitializationEvent e) {

proxy.preInit(e);

 

}

 

 

@EventHandler

public void init(FMLInitializationEvent e) {

 

EntityCreator.createMob(EntitySpartanSoldier.class, new RenderSpartanSoldier(), "SpartanSoldier", EnumCreatureType.MONSTER, 10, 0, 5, new BiomeGenBase[] {BiomeGenBase.desert}, 0xFF00FB, 0xD69D00, true);

 

EntityCreator.createMob(EntitySamurai.class, new RenderSamurai(), "Samurai", EnumCreatureType.MONSTER, 10, 0, 5, new BiomeGenBase[] {BiomeGenBase.desert}, 0xFF00FB, 0xD69D00, true);

proxy.init(e);

 

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent e) {

proxy.postInit(e);

}

}

 

 

 

 

EDIT

I fooled around a bit more duplicating the EntityCreator class naming it EntityCreator1 and the method createMob1 to see if there was something wrong with my EntityCreator class, but have discovered that it is in fact just that the code below the first EntitCreator line isnt being read in init...

Here is where I believe the problem is"

 

 

 

@EventHandler

public void init(FMLInitializationEvent e) {

 

EntityCreator.createMob(EntitySpartanSoldier.class, new RenderSpartanSoldier(), "SpartanSoldier", EnumCreatureType.MONSTER, 10, 0, 5, new BiomeGenBase[] {BiomeGenBase.desert}, 0xFF00FB, 0xD69D00, true);

 

EntityCreator.createMob(EntitySamurai.class, new RenderSamurai(), "Samurai", EnumCreatureType.MONSTER, 10, 0, 5, new BiomeGenBase[] {BiomeGenBase.desert}, 0xFF00FB, 0xD69D00, true);

proxy.init(e);

 

}

 

 

Link to comment
Share on other sites

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

    • If you're seeking an unparalleled solution to recover lost or stolen cryptocurrency, let me introduce you to GearHead Engineers Solutions. Their exceptional team of cybersecurity experts doesn't just restore your funds; they restore your peace of mind. With a blend of cutting-edge technology and unparalleled expertise, GearHead Engineers swiftly navigates the intricate web of the digital underworld to reclaim what's rightfully yours. In your moment of distress, they become your steadfast allies, guiding you through the intricate process of recovery with transparency, trustworthiness, and unwavering professionalism. Their team of seasoned web developers and cyber specialists possesses the acumen to dissect the most sophisticated schemes, leaving no stone unturned in their quest for justice. They don't just stop at recovering your assets; they go the extra mile to identify and track down the perpetrators, ensuring they face the consequences of their deceitful actions. What sets  GearHead Engineers apart is not just their technical prowess, but their unwavering commitment to their clients. From the moment you reach out to them, you're met with compassion, understanding, and a resolute determination to right the wrongs inflicted upon you. It's not just about reclaiming lost funds; it's about restoring faith in the digital landscape and empowering individuals to reclaim control over their financial futures. If you find yourself ensnared in the clutches of cybercrime, don't despair. Reach out to GearHead Engineers and let them weave their magic. With their expertise by your side, you can turn the tide against adversity and emerge stronger than ever before. In the realm of cybersecurity, GearHead Engineers reigns supreme. Don't just take my word for it—experience their unparalleled excellence for yourself. Your journey to recovery starts here.
    • Ok so this specific code freezes the game on world creation. This is what gets me so confused, i get that it might not be the best thing, but is it really so generation heavy?
    • Wizard web recovery has exhibited unparalleled strength in the realm of recovery. They stand out as the premier team to collaborate with if you encounter withdrawal difficulties from the platform where you’ve invested. Recently, I engaged with them to recover over a million dollars trapped in an investment platform I’d been involved with for months. I furnished their team with every detail of the investment, including accounts, names, and wallet addresses to which I sent the funds. This decision proved to be the best I’ve made, especially after realizing the company had scammed me.   Wizard web recovery ensures exemplary service delivery and ensures the perpetrators face justice. They employ advanced techniques to ensure you regain access to your funds. Understandably, many individuals who have fallen victim to investment scams may still regret engaging in online services again due to the trauma of being scammed. However, I implore you to take action. Seek assistance from Wizard Web Recovery today and witness their remarkable capabilities. I am grateful that I resisted their enticements, and despite the time it took me to discover Wizard web recovery, they ultimately fulfilled my primary objective. Without wizard web recovery intervention, I would have remained despondent and perplexed indefinitely.
    • I've tested the same code on three different envionrments (Desktop win10, desktop Linux and Laptop Linux) and it kinda blows up all the same. Gonna try this code and see if i can tune it
    • Minecraft version? Mod loader?
  • Topics

×
×
  • Create New...

Important Information

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