Thor597 Posted July 10, 2012 Posted July 10, 2012 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? Quote http://i.imgur.com/Hppni.png[/img]
Thor597 Posted July 10, 2012 Author Posted July 10, 2012 Please I need help! Quote http://i.imgur.com/Hppni.png[/img]
Thor597 Posted July 10, 2012 Author Posted July 10, 2012 On 7/10/2012 at 11:14 PM, jasonw749 said: 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! Quote http://i.imgur.com/Hppni.png[/img]
L.J.Duckfield Posted July 11, 2012 Posted July 11, 2012 Quote 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"... Quote
Thor597 Posted July 11, 2012 Author Posted July 11, 2012 On 7/11/2012 at 12:25 AM, L.J.Duckfield said: Quote 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? Quote http://i.imgur.com/Hppni.png[/img]
L.J.Duckfield Posted July 11, 2012 Posted July 11, 2012 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. Quote
Thor597 Posted July 11, 2012 Author Posted July 11, 2012 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 Quote http://i.imgur.com/Hppni.png[/img]
L.J.Duckfield Posted July 11, 2012 Posted July 11, 2012 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 Quote
Rheel Posted July 11, 2012 Posted July 11, 2012 On 7/10/2012 at 1:29 AM, Thor597 said: 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. Quote
Thor597 Posted July 11, 2012 Author Posted July 11, 2012 On 7/11/2012 at 8:34 AM, L.J.Duckfield said: 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 Quote http://i.imgur.com/Hppni.png[/img]
L.J.Duckfield Posted July 11, 2012 Posted July 11, 2012 Yes and that was given to you above... Java Reflection. Quote
Thor597 Posted July 11, 2012 Author Posted July 11, 2012 On 7/11/2012 at 2:37 PM, L.J.Duckfield said: 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: Quote http://i.imgur.com/Hppni.png[/img]
LexManos Posted July 11, 2012 Posted July 11, 2012 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. Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
atrain99 Posted July 11, 2012 Posted July 11, 2012 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. Quote So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
SoniEx2 Posted July 14, 2012 Posted July 14, 2012 http://pastebin.com/uUBYGZuY thats a litte code to add EMC values to your own blocks, I guess it may help... Quote No, you do NOT need jar modding!
Texasjake95 Posted July 14, 2012 Posted July 14, 2012 On 7/14/2012 at 5:59 AM, SoniEx2 said: 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... Quote
Recommended Posts
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.