| Type: | Protection |
| Supported software: | Paper, Folia |
| Supported versions: | 1.20 |
| Supported versions via older builds: | 1.16, 1.17, 1.18, 1.19 |
RayTraceAntiXray
Paper plugin for server-side async multithreaded ray tracing to hide ores that are exposed to air using Paper Anti-Xray engine-mode 1.Paper Anti-Xray can't hide ores that are exposed to air in caves for example (see picture below). This plugin is an add-on for Paper Anti-Xray to hide those ores too, using ray tracing to calculate whether or not those ores are visible to players.
How to install
- Download and install Paper 1.20.
- Enable Paper Anti-Xray using engine-mode: 1.
- Download and install ProtocolLib.
- Download and install RayTraceAntiXray. (For older Minecraft versions, browse the update history.)
- Configure RayTraceAntiXray by editing the file plugins/RayTraceAntiXray/config.yml (see default config below).
- See also: Recommended settings below.
- Note that you should restart your server after each of these steps. Don't enable, disable or reload this plugin on a running server under any circumstances (e.g. using /reload, plugin managers, etc.). It won't work properly and will cause issues.
Demo
Default config
YAML:
# This is an example configuration. Lines starting with # are comments and are ignored.
#
# settings:
# anti-xray:
# update-ticks: 1 # Time period in Minecraft ticks for sending block updates to reveal blocks.
# ms-per-ray-trace-tick: 50 # Target time per ray trace tick in milliseconds.
# ray-trace-threads: 2 # Number of threads that are used for ray tracing.
# world-settings:
# default: # All worlds inherit settings from the default section.
# anti-xray:
# ### Ray tracing related settings ###
# # RayTraceAntiXray hides blocks that are exposed to air, which are not hidden by Paper Anti-Xray.
# # For this, a list of block positions is created when a chunk is sent to a player based on the block selection related settings below.
# # Those blocks are hidden initally when the chunk is sent, which means they are replaced by stone, deepslate, netherrack or end stone depending on the world type.
# # Then they are ray traced to reveal the blocks that the player can actually see.
# ray-trace: true # Whether or not to enable ray tracing. Note that Paper Anti-Xray must also be enabled using engine-mode: 1.
# ray-trace-third-person: true # Whether or not to ray trace third person back and front view. Note that this is even more resource intensive.
# ray-trace-distance: 64.0 # Blocks with a greater distance between the block center and the player eye are not calculated and will thus stay hidden or revealed depending on the previous state.
# rehide-blocks: true # Whether or not to rehide revealed blocks that the player can no longer see. If false, revealed (already seen) blocks are only rehidden when the chunk is resent.
# rehide-distance: 60.0 # Blocks with a greater or equal distance between the block center and the player eye are treated as invisible to the player and are therefore (re)hidden (provided that rehide-blocks is enabled and the distance is still within the ray-trace-distance). If rehide-blocks is disabled, this setting has a similar effect as the ray-trace-distance and no effect if it is greater than the ray-trace-distance.
# ### Block selection related settings ###
# # The following settings are used to determine the list of block positions to be hidden and ray traced when a chunk is sent to a player.
# # Note that this list is not updated dynamically with newly placed or broken blocks until the chunk is resent.
# # Note that Paper Anti-Xray config settings, such as max-block-height, also apply.
# max-ray-trace-block-count-per-chunk: 30 # Maximum number of initially hidden and ray traced block positions per chunk. Counting starts at the bottom of the world and increases upwards.
# ray-trace-blocks: # Blocks that are hidden and ray traced. If this list is empty, the hidden-blocks specified in the Paper config file are used.
# - diamond_ore
# - deepslate_diamond_ore
# - emerald_ore
# - deepslate_emerald_ore
# lobby: # Example section for the world lobby. Missing settings are inherited from the default section.
# anti-xray:
# ray-trace: false # Disable ray tracing in the world lobby.
settings:
anti-xray:
update-ticks: 1
ms-per-ray-trace-tick: 50
ray-trace-threads: 2
world-settings:
default:
anti-xray:
ray-trace: true
ray-trace-third-person: false
ray-trace-distance: 80.0
rehide-blocks: false
rehide-distance: .inf
max-ray-trace-block-count-per-chunk: 100
ray-trace-blocks: [] Recommended settings
All settings are documented and explained in the default config file above. Before configuring the plugin you should enable Paper Anti-Xray using engine-mode: 1. Optionally (especially for testing) you can increase the max-block-height. After configuring Paper Anti-Xray you can configure the plugin using the following settings for example.Optimized
(Faster, but worse gameplay experience and less protection.)
YAML:
settings:
anti-xray:
update-ticks: 1
ms-per-ray-trace-tick: 50
# Adjust to available (ideally unused) CPU threads.
ray-trace-threads: 2
world-settings:
default:
anti-xray:
ray-trace: true
ray-trace-third-person: false
ray-trace-distance: 64.0
rehide-blocks: false
rehide-distance: .inf
max-ray-trace-block-count-per-chunk: 30
ray-trace-blocks:
# You can add further blocks here,
# but the max-ray-trace-block-count-per-chunk setting may need to be adjusted.
- chest
- diamond_ore
- deepslate_diamond_ore
- emerald_ore
- deepslate_emerald_ore
- gold_ore
- deepslate_gold_ore
- lapis_ore
- deepslate_lapis_ore
- spawner
# Adjust world name.
world_nether:
anti-xray:
# Note that ancient_debris never generates naturally exposed to air.
# Normal engine-mode: 1 is sufficient, disable ray tracing in the nether.
ray-trace: false
# Adjust world name.
world_the_end:
anti-xray:
ray-trace: false More expensive
(Slower, but better gameplay experience and more protection.)
YAML:
settings:
anti-xray:
update-ticks: 1
ms-per-ray-trace-tick: 50
# Adjust to available (ideally unused) CPU threads.
ray-trace-threads: 2
world-settings:
default:
anti-xray:
ray-trace: true
# Be aware that this is about three times as resource intensive.
ray-trace-third-person: true
ray-trace-distance: 80.0
rehide-blocks: true
rehide-distance: 76.0
max-ray-trace-block-count-per-chunk: 60
ray-trace-blocks:
# You can add further blocks here,
# but the max-ray-trace-block-count-per-chunk setting may need to be adjusted.
- chest
- diamond_ore
- deepslate_diamond_ore
- emerald_ore
- deepslate_emerald_ore
- gold_ore
- deepslate_gold_ore
- lapis_ore
- deepslate_lapis_ore
- mossy_cobblestone
- spawner
# Adjust world name.
world_nether:
anti-xray:
# Note that ancient_debris never generates naturally exposed to air.
# Normal engine-mode: 1 is sufficient, disable ray tracing in the nether.
ray-trace: false
# Adjust world name.
world_the_end:
anti-xray:
ray-trace: false