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

Anti-X-Ray exposed blocks #867

Merged

Conversation

PeriodicSeizures
Copy link
Contributor

@PeriodicSeizures PeriodicSeizures commented Aug 14, 2023

Description

This is a feature for X-Ray to deal with servers utilizing Anti-X-Ray. This is not a bypass, but rather a band-aid that makes X-Ray not outright useless on these servers (#860).

Findings

When X-Ray is enabled and the feature 'Show exposed' is toggled to enable, sometimes nothing changes. Disabling and enabling X-Ray seems to show the changes.

BlockUtils.canBeClicked is what is currently being used. Should fences, leaves, and other non-solid blocks be considered? Currently only air, water and lava are the primary exposed blocks. I left some comments and unused code that shows what I mean in reference to some non-solid blocks when initially testing.

Transparent / non-solids

X-Ray disabled
2023-08-14_11 11 11

X-Ray enabled
2023-08-14_11 11 19

@CLAassistant
Copy link

CLAassistant commented Aug 14, 2023

CLA assistant check
All committers have signed the CLA.

@Alexander01998 Alexander01998 added type:enhancement New feature or request status:merged This pull request has been merged, even if GitHub says otherwise. area:settings Improves the settings of existing features. category:render labels Aug 17, 2023
@Alexander01998 Alexander01998 added this to the v7.36 milestone Aug 17, 2023
@Alexander01998 Alexander01998 merged commit 04af4ff into Wurst-Imperium:master Aug 17, 2023
2 checks passed
@Alexander01998
Copy link
Member

Hey @PeriodicSeizures, thanks for the pull request!

I've tested out your changes on a local Paper server with the anti-X-Ray option enabled, and it seems to be working well.

Based on my testing, it seems that Paper considers any block that isn't a full opaque block to expose ores placed next to it, even if the ores aren't actually visible. I've attached screenshots below to show what I mean:

X-Ray disabled
X-Ray Disabled

X-Ray enabled
X-Ray Enabled

As you can see, even though the lava, the closed iron door, and the front-facing birch stairs obscure the diamond ores from view, anti-X-Ray doesn't hide these ores from X-Ray. Only the ones covered by full blocks get scrambled.

I've changed the code to match Paper's behavior, by using the isOpaqueFullCube() method to determine whether a block should be considered exposed or not, instead of maintaining a separate list of "exposing" blocks.

I've also gone ahead and merged the pull request. Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:settings Improves the settings of existing features. category:render status:merged This pull request has been merged, even if GitHub says otherwise. type:enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants