Posted October 13, 20186 yr Hey everyone, been trying for a while to look for a solution to this problem: So i am looking for certain mobs to spawn with entitySpawned(EntityJoinWorldEvent event) Then when i find the mob i'm looking for i want to do something like this to it: //Obviously just a dumbed down example public void entitySpawned(EntityJoinWorldEvent event) { Entity entity = event.getEntity(); if (true) { entity.onDead(someFunction()); //Runs when the entity dies. } } What would be a ideal solution to this?
October 13, 20186 yr Capabilities. You create one, apply it to the entity when it is spawned, then in the EntityDeathEvent you check to see if that capability is there, and if so, do something. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 13, 20186 yr Author 2 minutes ago, Draco18s said: Capabilities. You create one, apply it to the entity when it is spawned, then in the EntityDeathEvent you check to see if that capability is there, and if so, do something. Ah thanks, was hoping there was a cleaner way to do it but i guess not.
October 13, 20186 yr Author 7 minutes ago, Draco18s said: Capabilities. You create one, apply it to the entity when it is spawned, then in the EntityDeathEvent you check to see if that capability is there, and if so, do something. Is capabilities something originally from Java or from forge, i never heard of it before.
October 13, 20186 yr The Capabilities systems are supplied by Forge. They're an advancement on IEntityExtendedStorage (among other things) Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 13, 20186 yr Author 32 minutes ago, Draco18s said: The Capabilities systems are supplied by Forge. They're an advancement on IEntityExtendedStorage (among other things) Ah, any chance you can send me some documentation or supply me with a code snippet?
October 13, 20186 yr https://mcforge.readthedocs.io/en/latest/datastorage/capabilities/ Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 14, 20186 yr 4 hours ago, Robin Withes said: Is capabilities something originally from Java or from forge, i never heard of it before. Capabilities are a concept from Object Oriented Programming (like Objects and Interfaces). They allow for programming in the style “composition over inheritance”. Sorry for the badly worded answer, these articles explain it well. https://en.m.wikipedia.org/wiki/Composition_over_inheritance https://en.m.wikipedia.org/wiki/Encapsulation_(computer_programming) About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
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.