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

Hello everybody, im new to this forum and this is my very first post :=)

So, basically, i want that i can place saplings and stuff on my own block. a quick look revealed that it has todo with the "canThisPlantGrowOnThisBlockID" method inside BlockFlower. It checks for the id of the blocked to be placed and only when it matches it places it.

Problem is, that the block that are allowed are hardcoded. i searched around a bit and came to the conclusion that i need a coremod and need to patch this method using bytecode manipulation. Now, i really have no clue on how todo those things^^

It would be cool if you could help me and yeah, any help is much appreciated :)

 

regards, Marc

If you extend Block, you can override any (non-private or final) method in Block.

If you extend BlockFlower....

  • Author

yeah i mean vanilla saplings ;)

thats why i need to patch the BlockFlower.class ^^

Saplings are subclasses of BlockBush not BlockFlower from looking at 1,7.2 code.

 

However, trying to get a sapling to be plantable, is not a simple matter of deriving a class from grass, dirt, or farmland.

    protected boolean canPlaceBlockOn(Block p_149854_1_)
    {
        return p_149854_1_ == Blocks.grass || p_149854_1_ == Blocks.dirt || p_149854_1_ == Blocks.farmland;
    }

The above code hard-wires the check for a specific block, not just a suitably derived type of block. The code should have been written more like to make growing on other blocks readily possible.

    protected boolean canPlaceBlockOn(Block p_149854_1_)
    {
        return BlockGrass.class.isInstance(p_149854_1_) || BlockDirt.class.isInstance(p_149854_1_) || BlockFarmland.class.isInstance(p_149854_1_);
    }

I'm not sure (other than a coremod) how to make such things work.

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.