Jump to content

Recommended Posts

Posted

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!

Posted

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

}

}

 

 

 

 

 

Posted

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

 

Posted

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

 

}

 

 

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.