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,

For my mod, I'm interested in adding a custom type of "storm".  It would purely be a visual effect and does not need to impose any of the other effects that come from rain (e.g. putting out fires).

What would be the best option? I haven't found any other examples of this online.

My current approach is to spawn a bunch of Minecraft "RAIN" particle in a radius around the player - but to create an effective result I feel I will need to add a large number of particles and worry that would introduce lag.

Thanks for any help.

 

My current experimental implementation piggybacks off one of my crop entities to spawn particles around each player in the world - but I'm still just testing things out.

 


    @Override
    public void animateTick(BlockState p_180655_1_, World world, BlockPos p_180655_3_, Random p_180655_4_) {
        super.animateTick(p_180655_1_, world, p_180655_3_, p_180655_4_);
        for (PlayerEntity p : world.players()) {
            Vector3d position = p.getPosition(0);
            BlockPos blockPos = new BlockPos(position);
            // Instead of using directions, randomly spawn particles in a zone around the player
            for (Direction dir : Direction.values()) {
                BlockPos bpO = blockPos.relative(dir);
                for (Direction d2 : Direction.values()) {
                    BlockPos bp = bpO.relative(d2);
                    world.addParticle(ParticleTypes.RAIN, bp.getX(), bp.getY() + 1, bp.getZ(), 0.0D, 0.0D, 0.0D);
                }
            }
        }
    }

151856845-dce5f4e6-e449-4976-aa3a-81932f151856938-5430d258-e29c-4325-a0f2-f87f49

Edited by bradsk88

  • 2 weeks later...
  • Author

Figured it out.

 153699589-f774e340-cfcd-44a1-a279-d46e2d

TLDR

  • Enqueue work in FMLClientSetupEvent
  • In that work, grab the Overworld's DimensionRenderInfo and call setWeatherRenderHandler on it with your custom renderer.
  • In the renderer, copy the minecraft rain code and:
    • Provide your own ResourceLocation for RAIN_LOCATION
    • Remove the "-" from f3 value (I also multiplied it by 0.2 to slow down the rain)

Source

https://github.com/bradsk88/EurekaCraft/compare/4cfd071e8f5079184fb9be6a69b4316ce76c2d46...d13be10e423955eb4341f05ec94d46865adb1436

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.