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've a custom version of the Entity.handleWaterMovement in a custom entity for testing, and is working on that entity. Now, I want that all entities in game(or maybe just LivingEntity) use this new function instead of the vanilla version. For my custom entities a very bad solution is to copy-paste that code, but for vanilla... 

Is there a way?

 

The code aim to enable water movement to a custom fluid checking for its tag. The rest of the functioon is unalterated for the moment.

public boolean handleWaterMovement() {
        ResourceLocation customFluidTag = new ResourceLocation(MyMod.MOD_ID, "cust_fluid");
        if (this.getRidingEntity() instanceof BoatEntity) {
            this.inWater = false;
        } else if (this.handleFluidAcceleration(FluidTags.WATER) || this.handleFluidAcceleration(FluidTags.getCollection().getOrCreate(customFluidTag))) {
            if (!this.inWater && !this.firstUpdate) {
                this.doWaterSplashEffect();
            }
            this.fallDistance = 0.0F;
            this.inWater = true;
            this.extinguish();
        } else {
            this.inWater = false;
        }
        return this.inWater;
    }

 

Edited by Slexom
Edited

My mod:

Earth2Java - Mobs [1.15.2]

 

Howdy

 

I'm assuming that you don't want to add your custom fluid to the vanilla "water" Tag, then?

(i.e. like this https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe35_recipes)

 

If not - I don't think there is an easy way, no.

 

I don't have experience with this recently but the two key words that might be worth searching for are

"coremod"

and

"asm"

They will let you overwrite parts of the vanilla Entity::handleWaterMovement code.  It's a bit arcane and can be rather brittle but might be your only choice.

 

Cheers

  TGG

 

  • Author

A little bit exaggerated for half line of code. I'll put my fluid back on the water tag and fix what broke(fog color, lava interaction, etc.). 

Thank you for your reply. 

My mod:

Earth2Java - Mobs [1.15.2]

 

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.