Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

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

  • 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?

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.

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

 

 

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
  • 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

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

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.