Posted March 2, 201312 yr Hi, im making a mod, as probably most people here... For that i want to add a mob drop to monsters. For now lets say its just a gem. I will not show the class because i have yet to make, but lets say its a totally useless item for now, only exisiting and texture. The problem im having is that i want it to be dropped by monsters that die. If possibile a small chance. But i heared its a bad idea to edit base classes. So how can i do this?
March 2, 201312 yr use the LivingDropsEvent mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
March 2, 201312 yr Author use the LivingDropsEvent And now more detail please? I found the class, and have been trying things for more than half a hour. How do i add that method? And exactly where?
March 2, 201312 yr Author http://www.minecraftforum.net/topic/1419836-131-forge-4x-events-howto/ Ive did everything there, but i dont understand how to make sure there is also a chance my gem gets dropped by a dead mob, along with their usual stuff. Can i just, and if so where, do something like "drop = Item.diamond"? (diamond just to test first) My event class: package nomar.extramod; import java.util.ArrayList; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.Item; import net.minecraft.util.DamageSource; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; public class AddEvents { @ForgeSubscribe public void mobDrops(LivingDropsEvent event) { EntityLiving aaEntity = event.entityLiving; DamageSource aaDamage = event.source; ArrayList<EntityItem> aaDrops = event.drops; if (event.isCancelable()) { event.setCanceled(true); } } } In my @init: MinecraftForge.EVENT_BUS.register(new AddEvents());
March 3, 201312 yr what doesn't work? the event is working alright. if you want example here it is: https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/item/CustomDrop.java#L73, highlighted line is the adding new item to be dropped from currently killed entity. mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
August 11, 201312 yr what doesn't work? the event is working alright. if you want example here it is: https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/item/CustomDrop.java#L73, highlighted line is the adding new item to be dropped from currently killed entity. When did you make your mod? it has stuff my mod has. MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
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.