Posted June 10, 201411 yr In the mod that I'm working on I need to make it so that BlockMonsterSpawner (vanilla) drops a MobCage (my mod) when it is destroyed. I've looked for a @SubscribeEvent to use but cannot find one for block destruction, and as such have come to believe that there is not a way to do so without editing BlockMonsterSpawner.class. My question, therefore, is twofold: [*]Is there a way to modify or add to vanilla block drops in Forge? (The version I have in my environment is the current Recommended (10.12.1.1060).) [*]If not, as I suspect and have seen several times from repeated googling, how should I go about changing the getItemDropped(int, Random, int) and quantityDropped(Random) methods to make BlockMonsterSpawner drop a MobCage? As is in Eclipse I cannot just edit the Minecraft files as they are read-only (as they should be). Thank you in advance for your help for a beginning modder. If you're interested, my workspace is Eclipse as set up by Wuppy in his tutorial on setting up Forge development enviroment (http://www.wuppy29.com/minecraft/modding-tutorials/wuppys-minecraft-forge-modding-tutorials-for-1-7-set-up-part-2b-advanced-forge-setup/). http://i1279.photobucket.com/albums/y523/textcraft/Jun%202014%20-%202/a77dd69ddfa9e622422c5e5cd7e377b14d5cdedec1b7a8e19dde68c9e22be6dfbf81219d3893f419da39a3ee5e6b4b0d3255bfef95601890afd8070929aa338b0dfc68d48355_zps0c847cf3.png[/img] I have a reputation for text walls. If you ask me a question I will most likely explain it in the most wordy way possible. -0 characters left
June 10, 201411 yr Subscribe to Blockevent.Blockbreak event. Check that is the block is a spawner and add your item to the drops list
June 10, 201411 yr Author As seems always the case, the OP has solved their own problem moments after posting it due to finding something they originally overlooked. When looking one more time in net.minecraftforge.event I found that net.minecraftforge.event.BlockEvent held a class HarvestDropsEvent that does exactly what I wanted to. By pushing a(n?) @SubscribeEvent on(HarvestDropsEvent) to MinecraftForge.EVENT_BUS I was able to hook an event that if the block that checks for dropping happens to be an instanceof BlockMonsterSpawner to add an ItemStack(mobCage, 1) to the drop queue. I hope that in the future people searching for how to do Custom Vanilla Block Drops in Forge can find this thread or do what I have done and find it themself so they can continue on and make great (or at least working) mods. My Listening class for those interested to accomplish this task: https://gist.github.com/CAD97/0f67b8f95804a0bd2d90 http://i1279.photobucket.com/albums/y523/textcraft/Jun%202014%20-%202/a77dd69ddfa9e622422c5e5cd7e377b14d5cdedec1b7a8e19dde68c9e22be6dfbf81219d3893f419da39a3ee5e6b4b0d3255bfef95601890afd8070929aa338b0dfc68d48355_zps0c847cf3.png[/img] I have a reputation for text walls. If you ask me a question I will most likely explain it in the most wordy way possible. -0 characters left
June 10, 201411 yr Author Oh, and thanks for answering Degubi, but you were a little too slow http://i1279.photobucket.com/albums/y523/textcraft/Jun%202014%20-%202/a77dd69ddfa9e622422c5e5cd7e377b14d5cdedec1b7a8e19dde68c9e22be6dfbf81219d3893f419da39a3ee5e6b4b0d3255bfef95601890afd8070929aa338b0dfc68d48355_zps0c847cf3.png[/img] I have a reputation for text walls. If you ask me a question I will most likely explain it in the most wordy way possible. -0 characters left
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.