Posted September 28, 20196 yr 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
September 28, 20196 yr 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: Create the Entity class - depending on what behavior you want, you will choose which Entity class to extends Register the Entity by handling RegistryEvent.Register<EntityType<?>> and using EntityType.Builder 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 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.
September 29, 20196 yr Author 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); } }
October 1, 20196 yr Author would it help, if you had my code? I'm just not good enough in coding, to now where I put those commands, and how to link them, etc...
October 1, 20196 yr 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.
October 5, 20196 yr 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 October 5, 20196 yr 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.