Jump to content

Recommended Posts

Posted

Hey Guys,

I could really use some help with my Mod, especially with my entities...
I'm pretty new in programming, java and modding, and taught myself the stuff I need to know to create recipes, items, blocks, armors, and weapons. Sadly the tutorial I was using for help doesn't cover entities and other tutorials are always different in their coding, filesystem, and explanations.
I am from Germany, so it's even harder for me,  to learn a new language in a foreign one.

Could you help me, and show me in simple steps, how I can add entities into my Mod? 

 

Thanks!!!

Lexi

Posted

I will assume you are using 1.13 or 1.14. If that is not the case, let us know.

Adding entities is, unfortunately, not simple. There are many steps:

  1. Create the Entity class - depending on what behavior you want, you will choose which Entity class to extends
  2. Register the Entity by handling RegistryEvent.Register<EntityType<?>> and using EntityType.Builder
  3. Create the Entity model (or extends an existing model class) and texture. This has not changed since 1.10 or 1.12 so you should be able to find tutorials about it
  4. Register the Entity model. This has not changed since 1.12 (you use a IRenderFactory and register client-side only after registering your entity)

#1 - Choose an Entity Class to extend based on what you want it to do. If you want a basic zombie-like mob, extend MonsterEntity or even ZombieEntity. If you want a passive mob, extend AnimalEntity. (If there is no "baby" version, extend CreatureEntity). There are tons of options but you should choose whatever is most similar to your desired entity

#2 - Take a look at this post for the registration part of things.

#3 - Look up a tutorial for making entity models. Back in 1.7.10 I used Techne but I know there are much better modeling programs out there by now. Make a Render class to use the model. See this GitHub for examples.

#4 - Call RenderingRegistry.registerEntityRenderingHandler(MyEntity.class, MyEntityRender::new) after registering the entity itself.

I guarantee that you will have many, many problems along the way as Entities are one of the harder parts of Minecraft modding. I haven't even mentioned AI and Goals, Tameable mobs, Rideable mobs, etc.

Good luck.

Posted

Oh yes, sorry...
I'm actually using 1.12.2, because I started my mod about 1,5 years ago, paused it, deleted it, etc

Thank you, I'll try it out right away, but I have already a question:

14 hours ago, skyjay1 said:

you use a IRenderFactory and register client-side only after registering your entity

I never used an IRenderFactory. I register my blocks and items with ModelRegistryHandler so it looks like that:
 

Spoiler

 


package lexinoctura.fandomcraft.util.PJ;

import lexinoctura.fandomcraft.init.PJ.PJ_Entity;
import lexinoctura.fandomcraft.init.PJ.PJ_Items;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;

@EventBusSubscriber(Side.CLIENT)

public class PJ_Items_ModelRegistryHandler {
 
    @SubscribeEvent
 
    public static void registerModels(ModelRegistryEvent event) {
 
    	//Metalle
        registerModel(PJ_Items.hb_barren);
        registerModel(PJ_Items.ig_barren);
        registerModel(PJ_Items.se_barren);
        
        //Anderes
        registerModel(PJ_Items.dracon_knochen);
 
    }
 
    private static void registerModel(Item item) {
 
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
 
    }
 
}

and RegistryHandler

Spoiler

package lexinoctura.fandomcraft.util.PJ;

import lexinoctura.fandomcraft.item.PJ.PJ_ItemBase;
import net.minecraft.item.Item;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@EventBusSubscriber

public class PJ_Items_RegistryHandler {
 
    @SubscribeEvent
 
    public static void registerItems(Register<Item> event) {
 
        final Item[] items = {
        		//Metalle
                new PJ_ItemBase("hb_barren", "hb_barren"),
                new PJ_ItemBase("ig_barren", "ig_barren"),
                new PJ_ItemBase("se_barren", "se_barren"),
 
                //Anderes
                new PJ_ItemBase("dracon_knochen", "dracon_knochen")
                
          
        };
 
        event.getRegistry().registerAll(items);
 
    }
 
}

 

 

Posted
On 9/29/2019 at 4:03 AM, Lexi_Noctura said:

I never used an IRenderFactory. I register my blocks and items with ModelRegistryHandler so it looks like that:

Look for the class called IRenderFactory then look at where it is used and you'll find RenderingRegistry.registerEntityRenderingHandler or something close to that.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)

An IRenderFactory is automatically created when you type MyRenderClass::new
You don't have to worry about actually instantiating one unless you're going to re-use it.

Edit: This is the same in 1.12 as it is in 1.14

Edited by skyjay1

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

    • Ignore shrimple, it doesn't work with Oculus. Also, enableShaders was alr true when it said that towards the end of the log. If you could also figure out why my tags are messed up that'd be cool too, but that's a later issue. https://drive.google.com/drive/folders/1ovEKDZECUCl7zZxGfpyQcS4s5PZPQyfa?usp=drive_link
    • accidental duplicate mesage cuz lag
    • https://gnomebot.dev/paste/231527759279685634/1372324909073563730/1372324908629102716 https://gnomebot.dev/paste/231527759279685634/1372320454861262908/1372320454299090996 seems like theres a registry sync error, not sure what that means though, however in an old pack i played on, i actually had a registry sync error happen whenever the world tried too save and it would suddenly stop loading chunks, is there a mod fix for this or some way too bypass registry syncing? is this a server problem? i have no issues with the pack on pc, only on my server.
    • i think the problem is the player animator library but i need it for one of my main mods is there any way i can fix this? The game crashed: rendering overlay Error: java.lang.IllegalArgumentException: Failed to create player model for default heres the crash report: https://pastebin.com/U5Wp8ysb
    • I have been an enthusiastic investor in crypt0currencies for several years, and my digital assets have been integral to my financial strategy. A few months ago, I encountered a distressing predicament when I lost access to my primary cryptocurrency walleet after clicking on an airdrop link that inadvertently connected to my walleet. The dread of potentially losing all my hard-earned funds was overwhelming, leaving me uncertain about where to seek assistance. In my pursuit of solutions, I stumbled upon ChainDigger Retrievers. From our initial consultation to the triumphant recovery of my assets, the team exhibited exceptional expertise. They provided comprehensive explanations of the recovery process, ensuring I was informed at every stage and offering reassurance during this tumultuous time. Their approach was not only meticulous but also compassionate, which significantly alleviated my anxiety. ChainDigger Retrievers unwavering commitment to resolving my issue was evident throughout the process. Leveraging their profound understanding of crypt0currency technology and digital forensics, they initiated an exhaustive investigation to trace the transactions linked to my compromised wallet. Their meticulous analysis and relentless determination were apparent as they left no stone unturned in their quest to recover my funds. After several days of diligent investigation, the team successfully recovered everything I had lost. They uncovered that the link I had clicked contained malware, which scammeers had used to infiltrate my walleet. This revelation was both alarming and enlightening, underscoring the inherent risks associated with crypt0currency transactions when proper precautions are not taken.Thanks to ChainDigger Retrievers, I not only regained everything but also acquired invaluable knowledge about safeguarding my investments. Their expertise and steadfast support transformed a daunting situation into a manageable one, and I am profoundly grateful for their assistance. I can now continue my investment journey with renewed confidence, knowing that I have a trustworthy ally in ChainDigger Retrievers. Their client satisfaction is truly commendable, and I wholeheartedly recommend their services to anyone facing similar challenges in the crypt0currency realm. With their help, I was able to turn a distressing time into a positive outcome, and I will forever be grateful for their support.  
  • Topics

×
×
  • Create New...

Important Information

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