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

Bukkit has an event which can be used to modify the result of mixing lava and water. I'm wondering if Forge has something similar. I don't see anything in net.minecraft,block.BlockLiquid.checkForMixing, but I thought I'd double check here before I try anything too complex.

 

My intention is to modify minecraft's behavior such that you can get granite etc. from a cobblestone generator.

 

Would this not be possible (but ugly) with an IWorldEventListener & overriding IWorldEventListener::notifyBlockUpdate? Would require some guess-work to make sure it was indeed placed by BlockLiquid::checkForMixing, but should be viable.

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

  • Author

It is possible; I've confirmed that this code has the desired effect:

public void notifyBlockUpdate(World worldIn, BlockPos pos, IBlockState oldState, IBlockState newState, int flags){
    if (oldState.getBlock() != Blocks.FLOWING_LAVA) return;
    if (newState.getBlock() != Blocks.COBBLESTONE) return;

    boolean adjacentToWater = false;
    if (worldIn.getBlockState(pos.north()).getMaterial() == Material.WATER) adjacentToWater = true;
    if (worldIn.getBlockState(pos.south()).getMaterial() == Material.WATER) adjacentToWater = true;
    if (worldIn.getBlockState(pos.east() ).getMaterial() == Material.WATER) adjacentToWater = true;
    if (worldIn.getBlockState(pos.west() ).getMaterial() == Material.WATER) adjacentToWater = true;
    if (worldIn.getBlockState(pos.down() ).getMaterial() == Material.WATER) adjacentToWater = true;
    if (worldIn.getBlockState(pos.up()   ).getMaterial() == Material.WATER) adjacentToWater = true;
    if(!adjacentToWater) return;

    worldIn.setBlockState(pos, Blocks.DIAMOND_BLOCK.getDefaultState());
}

But like you said, I'm using guess-work.

 

I would still be interested in submitting a PR - if my technical knowledge extended to all that "@@ -452,4 +452,29 @@" stuff in BlockLiquid.java.patch. I don't suppose anyone has suggestions for topics to google?

 

You don't write the patches yourself, you set up a Forge workspace, make your changes to the appropriate Vanilla classes and then run the genPatches Gradle task to re-generate the patches with your changes.

 

Forge's documentation explains how to contribute to Forge here and here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.