Jump to content

Recommended Posts

Posted (edited)

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]

 

Posted

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

 

  • Thanks 1

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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