---
title: "Paper: Minecraft respawn radius fix in Java | VulCode"
description: "A fix in Paper, the Minecraft server written in Java: with a large respawn_radius, players respawn across the whole square, not just near its Z axis edge."
url: "https://vulcode.com/en/opensource/contributions/paper"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/contributions)

PaperMC/Paper

# Paper

A performance-focused Minecraft server that fixes gameplay and mechanics inconsistencies. It keeps its changes to the game code as patches on the Minecraft sources.

[See the repository](https://github.com/PaperMC/Paper) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: Java
- **GitHub stars**: 12,832
- **Merged changes**: 1
- **Project site**: [papermc.io](https://papermc.io/software/paper)

## What we changed

With a large respawn radius, set by the respawn_radius game rule, players respawn anywhere in the whole square, not only in its first rows on the Z axis.

### What this work shows

- Modular arithmetic and coprime strides

- Patches on Minecraft server code

- Integer overflow in Java

What was broken

### Respawns only landed in part of the square

The respawn_radius game rule defines a square around the spawn point. PlayerSpawnFinder capped both the number of attempts and the range of candidate positions at 1024, so from radius 16 up the candidates only covered the first rows of the square on the Z axis, and with a large radius players always respawned close to the lowest Z value.

How we fixed it

### Sampling from the whole square

Candidates are now drawn from the whole area of the square, and the cap only applies to the number of attempts. The stride is chosen to be coprime with the area, because the old value of 17 divides some areas, such as 51 by 51, and the index is computed as a long so it cannot overflow an int.

[#14390](https://github.com/PaperMC/Paper/pull/14390)

## Merged change 1

- [#14390 Fix respawn radius only covering part of the square Merged 31 October 2026](https://github.com/PaperMC/Paper/pull/14390)

## What it taught us

A modular arithmetic bug can show up only at large setting values, so the edges of the range have to be tested too. We made the fix in a project maintained as patches on someone else's source code.

[More about this technology: Java](https://vulcode.com/en/technologies/java)

## Other projects we write code for

- [**Spotless** Java · 5,736 stars A Gradle and Maven plugin that formats code in many languages, from Java and Kotlin to SQL and YAML, and enforces that formatting in the build.](https://vulcode.com/en/opensource/contributions/spotless)

- [**Node.js** JavaScript · 123,955 stars The JavaScript runtime built on V8 that runs servers, command line tools and front-end build pipelines. It ships a built-in node:sqlite module for working with SQLite databases.](https://vulcode.com/en/opensource/contributions/nodejs)

- [**Godot Engine** C++ · 120,623 stars An open source, multi-platform 2D and 3D game engine with its own editor, where game developers build scenes and interfaces.](https://vulcode.com/en/opensource/contributions/godot)

- [**Material UI** JavaScript · 99,391 stars A React component library that implements Google's Material Design: ready-made text fields, selects, buttons and other interface elements.](https://vulcode.com/en/opensource/contributions/material-ui)

- [**Zed** Rust · 95,562 stars A fast code editor in Rust from the creators of Atom and Tree-sitter, with live multiplayer editing.](https://vulcode.com/en/opensource/contributions/zed)

- [**uv** Rust · 92,647 stars An extremely fast Python package and project manager written in Rust. It creates projects, installs dependencies and manages virtual environments.](https://vulcode.com/en/opensource/contributions/uv)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
