squeek502 / AppleCore

An API for modifying the food and hunger mechanics of Minecraft
The Unlicense
55 stars 24 forks source link

Add way to handle exhaustion values on block break/walk/sprint/jump etc. #132

Closed zcaliptium closed 5 years ago

zcaliptium commented 5 years ago

Hello! I am using AppleCore and... Making complex mod which enhances survival aspects of Minecraft. Seems like AC doesn't provide functionality to tweak some hardcoded values related to hunger defined by Mojang. In my opinion AC should provide full and fancy control over all stuff related to hunger.

Like:

For example exhaunstion value on jump. Code at EntityPlayer:

    public void jump()
    {
        super.jump();
        this.addStat(StatList.JUMP);

        if (this.isSprinting())
        {
            this.addExhaustion(0.2F);
        }
        else
        {
            this.addExhaustion(0.05F);
        }
    }

I really need this functionality.
But I don't really want to make own coremod to tweak these values. There also option for some cases make ugly hack through Forge event handlers for LivingUpdateEvent and or AttackEntityEvent and add back wasted amount of exhaustion, and then add my value. But how to be in case of jumping?

squeek502 commented 5 years ago

Seems reasonable. :+1:

squeek502 commented 5 years ago

@zcaliptium how much context do you want provided for this sort of thing? For example, would it be good enough to just know that the exhaustion is coming from a block being broken, or do you expect to also know which block was broken?

squeek502 commented 5 years ago

Let me know what you think of this:

EDIT: Also, just to make sure, you need this for Minecraft 1.12.2, right? Might not backport this unless I need to.

zcaliptium commented 5 years ago

Correct. I need it only for 1.12.2. And... I think don't need information about broken block.

Thank you. I will check out new event ASAP.

zcaliptium commented 5 years ago

Wow! Compiled AppleCore out of recent commit. I tested it out - It works fine! <3 Thank you again! I think you may close this Issue.

squeek502 commented 5 years ago

Glad to hear it. Will close once I release a version with this change in it.

squeek502 commented 5 years ago

Released in v3.2.0.