Jump to content

Making vanilla blocks drop items without editing base classes


Thor597

Recommended Posts

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"...

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

mca.png
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.