Posted July 10, 201213 yr I was wondering if there was a way to make vanilla blocks drop items without editing the block file. In my case I want to make ice drop salt (from my mod) at a 1-10 chance without editing BlockIce, is there a way to do this? http://i.imgur.com/Hppni.png[/img]
July 10, 201213 yr Author http://lmgtfy.com/?q=java+reflection I am sorry but I didnt quite understand how that could help me in this particular situation, im a relatively new modder can you give me an excample of how this is used in the way I stated in the post above? Thank you! http://i.imgur.com/Hppni.png[/img]
July 11, 201213 yr Java reflection is useful because it supports dynamic retrieval of information about classes and data structures by name, and allows for their manipulation within an executing Java program. If you don't understand how that could be helpful, then you are probably copy / paste "modding"...
July 11, 201213 yr Author Java reflection is useful because it supports dynamic retrieval of information about classes and data structures by name, and allows for their manipulation within an executing Java program. If you don't understand how that could be helpful, then you are probably copy / paste "modding"... By not help me in this situation I mean it wont help me as I dont know how to use that to make vanilla blocks drop something. How do I use that in minecraft code? http://i.imgur.com/Hppni.png[/img]
July 11, 201213 yr then think of a block that drops an item and look at its class. (Redstone being one) you should be able to work out what you need to do from there. if not, read up on some tutorials.
July 11, 201213 yr Author Oh trust me I've searched for tutorials a looot, There is actually no-one I can find that does this. And when I search up something like this post name on google all I find is people that says its impossible http://i.imgur.com/Hppni.png[/img]
July 11, 201213 yr took me 2 seconds of looking at RedstoneOre to find this... /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { return Item.redstone.shiftedIndex; } if dropping one of your mods blocks, replace { return Item.redstone.shiftedIndex; } with... { return mod_XXXX.myItem.shiftedIndex; } so as i said, its in Redstone ore...as an example
July 11, 201213 yr I was wondering if there was a way to make vanilla blocks drop items without editing the block file. In my case I want to make ice drop salt (from my mod) at a 1-10 chance without editing BlockIce, is there a way to do this? Nope, not without editing base classes.
July 11, 201213 yr Author took me 2 seconds of looking at RedstoneOre to find this... /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { return Item.redstone.shiftedIndex; } if dropping one of your mods blocks, replace { return Item.redstone.shiftedIndex; } with... { return mod_XXXX.myItem.shiftedIndex; } so as i said, its in Redstone ore...as an example Did you read the topic name HOW TO ADD ITEM DROPS TO VANILLA BLOCKS WITHOUT EDITING BASE CLASSES LIKE MAKING ICE DROP SOMETHING WITHOUT EDITING BLOCKICE.JAVA http://i.imgur.com/Hppni.png[/img]
July 11, 201213 yr Author Yes and that was given to you above... Java Reflection. How do I use java reflection in minecraft code to help me do this then? Please help me D: http://i.imgur.com/Hppni.png[/img]
July 11, 201213 yr Alright just to shut up people You cant I want to add a hook for this but its very low on my priorities list right now. People who are saying reflection, please stop being a dick and only say reflection when you are right. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
July 11, 201213 yr As above, I agree. Maybe try to do something with a watcher class that checks the world for onBlockRemoval events, and then spawn the entity for salt. So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
July 14, 201213 yr http://pastebin.com/uUBYGZuY thats a litte code to add EMC values to your own blocks, I guess it may help... No, you do NOT need jar modding!
July 14, 201213 yr http://pastebin.com/uUBYGZuY thats a litte code to add EMC values to your own blocks, I guess it may help... Does that really work? Figured it would be much harder to do...
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.