Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wrong block placement distance check #458

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

Pilzinsel64
Copy link
Contributor

Fix block placement distance by players being wrong.

Typical symptom are blocks on the ceiling that disappear shortly after you you placed them. You can't place a block at the ceiling but can remove the block above it. Introduces in the past when Notch splitted of the server. If I'm not wrong, it's fixed in modern Minecraft versions.

Before:
https://github.com/user-attachments/assets/d2c328ec-3442-4a6e-888b-c6792e4b6e09

After:
https://github.com/user-attachments/assets/58d47d67-ea92-4974-904d-a0cfcb93400c

@Pilzinsel64 Pilzinsel64 requested a review from a team December 26, 2024 10:43
@Pilzinsel64 Pilzinsel64 marked this pull request as draft December 26, 2024 10:46
@Pilzinsel64 Pilzinsel64 force-pushed the feat/fixwrongblockplacementdistancecheck branch from 2f246b8 to 96deb74 Compare December 26, 2024 10:58
@Pilzinsel64

This comment was marked as outdated.

@Pilzinsel64 Pilzinsel64 force-pushed the feat/fixwrongblockplacementdistancecheck branch from 96deb74 to 2918655 Compare December 26, 2024 12:28
@Pilzinsel64 Pilzinsel64 marked this pull request as ready for review December 26, 2024 12:29
@Pilzinsel64 Pilzinsel64 force-pushed the feat/fixwrongblockplacementdistancecheck branch from 2918655 to c774f2e Compare December 26, 2024 12:35
Copy link

@Ethryan Ethryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I’m not really used to mixin code so I could have missed something.

@Caedis
Copy link
Member

Caedis commented Dec 26, 2024

I did find this

double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + (double)(worldIn.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight()); // isRemote check to revert changes to ray trace position due to adding the eye height clientside and player yOffset differences

Might want to look at that instead of using a hardcoded value

@Pilzinsel64
Copy link
Contributor Author

Might want to look at that instead of using a hardcoded value

Would be an idea to use the eye height, yes. But would need to do in the other method too. Can't today, maybe tomorrow.
@Caedis where did you find this snippet?

@Pilzinsel64
Copy link
Contributor Author

Pilzinsel64 commented Dec 26, 2024

getEyeHeight() and getDefaultEyeHeight() returns 0.12 and not 0.15 where 0.15 I grabbed from NetHandlerPlayServer.processPlayerDigging(). Not sure what's correct or where exactly is the client-side check.
@Caedis Can you point me a bit to the right direction please? I'm a bit slow on the uptake. 🙈

@Caedis
Copy link
Member

Caedis commented Dec 26, 2024

getDefaultEyeHeight() should be returning a static 1.5

or not....

EntityPlayerMP overrides it

@Override
    public float getDefaultEyeHeight()
    {
        return 1.62F;
    }

@Caedis
Copy link
Member

Caedis commented Dec 26, 2024

@Pilzinsel64 can you link the mc bug report since you say it was fixed in modern?

@Pilzinsel64
Copy link
Contributor Author

can you link the mc bug report since you say it was fixed in modern?

@Caedis Nah, sorry, didn't found it. I just remember that behavior didn't appear again in later versions. Not even sure when exactly it was fixed.

EntityPlayerMP overrides it

@Caedis Maybe that is the problem? However, not sure what I should do now. Should I just use getEyeHeight()?

@Dream-Master
Copy link
Member

Dream-Master commented Dec 27, 2024

not merge yet need some more work Pilzinsel told me

@Pilzinsel64 Pilzinsel64 force-pushed the feat/fixwrongblockplacementdistancecheck branch from b08a8bc to 0427a71 Compare December 27, 2024 18:10
@Pilzinsel64
Copy link
Contributor Author

Quick update, can be merged from my side now. Using entity.getEyeHeight() instead of the constant value `1.5D.

There could be added a second method in the same mixin here with a future PR to also optimize the processPlayerDigging() method and also use entity.getEyeHeight() instead of the constant value there. However, this would lead to even more work in the renderer probably and isn't just a small fix then.

@Caedis hope that's also fine for you.

@Pilzinsel64 Pilzinsel64 requested a review from Caedis December 27, 2024 18:14
@Caedis
Copy link
Member

Caedis commented Dec 27, 2024

Tested on both SP and MP?

@Pilzinsel64
Copy link
Contributor Author

Pilzinsel64 commented Dec 27, 2024

Tested on both SP and MP?

@Caedis Only SP yet. Not sure if @Dream-Master put this on Zeta yet. Can't get the obfuscated jar of Hodgepodge to work on client for some reason since the last rebase on master.

@Dream-Master Dream-Master merged commit 61a0245 into master Dec 27, 2024
1 check passed
@Dream-Master Dream-Master deleted the feat/fixwrongblockplacementdistancecheck branch December 27, 2024 21:09
Dream-Master pushed a commit that referenced this pull request Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants