With X-ray mods or texture packs, players can see ores through walls and find diamonds in minutes. Paper has a built-in Anti-Xray feature to counter this: the server sends players false data for hidden blocks, so an X-ray client only sees stone or random fake ores. Anti-Xray is disabled by default. In this guide, you'll learn how to enable it, which mode is right for your server, and what its limitations are.
- A Minecraft server running the Paper or Purpur server type (Purpur is based on Paper). Paper's Anti-Xray feature isn't available on Vanilla, Fabric, or Forge. You can change the server type under Games & variants; see Switch games and manage variants.
- The settings are in the
config/paper-world-defaults.ymlfile. The Files tab automatically opens the folder for your active variant, for example,minecraft/paper/.
Back up the file first If you've already changed other values in the file, download it to your PC using Download before editing it.
Use engine-mode to choose how Paper hides ores:
| Mode | How it works | Protection | Performance |
|---|---|---|---|
1 | Hidden blocks appear as stone (deepslate below Y 0, netherrack in the Nether, and end stone in the End). | Hides only ores completely surrounded by solid blocks. Ores next to caves or water remain visible. | Uses the fewest resources, especially on the player side |
2 | Paper fills the rock with random fake ores. An X-ray client sees ores everywhere and can't find the real ones. | Better than mode 1 | Requires more processing, especially on the player side |
3 | Like mode 2, but uses the same fake blocks for each layer of a chunk instead of for each block. | Similar to mode 2 | Roughly halves the amount of data sent when entering and is easier to compress |
Mode 1 has the least impact on performance. To make X-ray more difficult, use mode 2 or 3.
- Stop your server.
- In the Files tab, open the
config/paper-world-defaults.ymlfile. - Find the
anticheat:section and itsanti-xray:subsection, then replace it with one of the blocks below. - Click Save and start your server.
Pay attention to indentation YAML files are sensitive to spaces. Use the exact indentation shown and don't use tabs.
anticheat:
anti-xray:
enabled: true
engine-mode: 1
hidden-blocks:
- chest
- coal_ore
- deepslate_coal_ore
- copper_ore
- deepslate_copper_ore
- raw_copper_block
- diamond_ore
- deepslate_diamond_ore
- emerald_ore
- deepslate_emerald_ore
- gold_ore
- deepslate_gold_ore
- iron_ore
- deepslate_iron_ore
- raw_iron_block
- lapis_ore
- deepslate_lapis_ore
- redstone_ore
- deepslate_redstone_ore
lava-obscures: false
max-block-height: 64
replacement-blocks: []
update-radius: 2
use-permission: false
For mode 3, use the same block and only change engine-mode: 3.
anticheat:
anti-xray:
enabled: true
engine-mode: 2
hidden-blocks:
- air
- copper_ore
- deepslate_copper_ore
- raw_copper_block
- diamond_ore
- deepslate_diamond_ore
- gold_ore
- deepslate_gold_ore
- iron_ore
- deepslate_iron_ore
- raw_iron_block
- lapis_ore
- deepslate_lapis_ore
- redstone_ore
- deepslate_redstone_ore
lava-obscures: false
max-block-height: 64
replacement-blocks:
- chest
- amethyst_block
- andesite
- budding_amethyst
- calcite
- coal_ore
- deepslate_coal_ore
- deepslate
- diorite
- dirt
- emerald_ore
- deepslate_emerald_ore
- granite
- gravel
- oak_planks
- smooth_basalt
- stone
- tuff
update-radius: 2
use-permission: false
air in hidden-blocks
With air in the list, Paper also creates fake holes. This helps counter cave finders and hides ores on cave walls, but may lower players' FPS. If your players experience issues, remove the - air line.
The values in paper-world-defaults.yml apply to all worlds. The Nether needs different blocks, and Anti-Xray isn't necessary in the End. Configure both in the paper-world.yml file in the folder for the relevant dimension. The folder location depends on your Minecraft version:
| Dimension | Paper 26.1 and later | Paper up to 1.21 |
|---|---|---|
| Nether | world/dimensions/minecraft/the_nether/paper-world.yml | world_nether/paper-world.yml |
| End | world/dimensions/minecraft/the_end/paper-world.yml | world_the_end/paper-world.yml |
If your world isn't named world, replace the name accordingly. See Manage worlds for more about the world format.
By default, the file only contains _version. Leave this line in place and add only the anticheat block below it. The world will continue to inherit all other values from paper-world-defaults.yml.
Nether with mode 1:
anticheat:
anti-xray:
enabled: true
engine-mode: 1
hidden-blocks:
- ancient_debris
- nether_gold_ore
- nether_quartz_ore
lava-obscures: false
max-block-height: 128
replacement-blocks: []
update-radius: 2
use-permission: false
Nether with mode 2 or 3:
anticheat:
anti-xray:
enabled: true
engine-mode: 2
hidden-blocks:
- air
- ancient_debris
- bone_block
- glowstone
- magma_block
- nether_bricks
- nether_gold_ore
- nether_quartz_ore
- polished_blackstone_bricks
lava-obscures: false
max-block-height: 128
replacement-blocks:
- basalt
- blackstone
- gravel
- netherrack
- soul_sand
- soul_soil
update-radius: 2
use-permission: false
End (all modes):
anticheat:
anti-xray:
enabled: false
Restart your server afterward.
| Setting | Meaning |
|---|---|
enabled | Turns Anti-Xray on (true) or off (false, default). |
engine-mode | Mode 1, 2, or 3; see above. |
hidden-blocks | Blocks to hide. In modes 2 and 3, these are also the fake blocks. In modes 2 and 3, Paper can't use chests or other blocks with contents as fake blocks. |
replacement-blocks | Modes 2 and 3 only: blocks that are additionally replaced with fake blocks, such as stone. This list isn't used in mode 1. |
max-block-height | Anti-Xray works up to this height. Values must be multiples of 16; Paper rounds other values down. Recommended: 64 in the Overworld, 128 in the Nether. |
update-radius | The radius within which Paper reveals real blocks when mining. Values from 0 to 2 are allowed; the default is 2. 0 is intended for testing only. |
lava-obscures | Also hides blocks adjacent to lava. Recommended: false. |
use-permission | When set to true, players with the paper.antixray.bypass permission can see the real ores. Recommended: false. Use only with an up-to-date permissions plugin. |
According to Paper, Anti-Xray deters most X-ray users, but it isn't foolproof, even in modes 2 and 3:
- Extended view distance: Some hacked clients can see real ores in a larger area around them. The only way to counter this is with an additional anti-cheat plugin; Paper doesn't include one. See Anti-cheat for your server to learn how to install one.
- World seed: If a client knows your world seed, it can calculate where ores are located. You can make this more difficult by using custom
feature-seedsinpaper-world-defaults.ymltogether with the structure seeds inspigot.yml. It can't be prevented completely, so don't share your world seed. - Ores next to caves and water: They remain visible in mode 1. In modes 2 and 3, they are hidden only if
airis inhidden-blocks.
I can still see ores. Check whether the ores are above max-block-height, whether they're next to air or water, and whether the block is missing from your list. If use-permission is set to true, players with OP permissions can see the real ores.
It doesn't work below Y 0 or in certain biomes. Your list probably doesn't include blocks such as deepslate or basalt. Add all of the recommended blocks above.
My changes aren't taking effect. Paper only reads these settings when it starts. Restart your server and don't use /reload. Also check the file's indentation.