Understanding Patch Types
Paper uses three types of patches:sources: Per-file patches to Minecraft Java classesresources: Per-file patches to Minecraft data filesfeatures: Larger patches that modify multiple Minecraft classes for complex features
Modifying Per-File Minecraft Patches
This is the most common workflow when editing Minecraft files.Make Your Changes
paper-server/src/minecraft as needed.Fixup Source Patches
Rebuild Patches
Resolving Rebase Conflicts
IffixupSourcePatches encounters conflicts, you’ll need to manually resolve them:
Stash Your Changes (Optional)
git stash pop.Start Interactive Rebase
:q! and Enter to exit. Then run export EDITOR=nano before trying again for an easier editor.Mark Commit for Editing
pick with edit for the commit you want to modify (typically the first commit, paper File Patches). Save and close the editor.Make Your Changes
Stage and Amend
Continue Rebase
Rebuild Patches
Adding Larger Feature Patches
Feature patches are used for substantial changes that are difficult to track in per-file patches.Make Your Changes
paper-server/src/minecraft as needed.Stage Your Changes
Create a Commit
Rebuild Patches
Modifying Larger Feature Patches
You can modify existing feature patches using either the manual rebase method (see Resolving Rebase Conflicts) or the fixup method below.Fixup Method (Manual)
Make Your Changes
Create Temporary Commit
Interactive Rebase
Change Pick to Fixup/Squash
forfixup: Merge changes without modifying the commit messagesorsquash: Merge changes and edit the commit message
Rebuild Patches
Fixup Method (Automatic)
Make Your Changes
Create Fixup Commit
git commit -a --fixup file. Use --squash instead of --fixup if you want to modify the commit message too.git logorgit blame- Your IDE’s git integration
- Commit subject:
git commit -a --fixup "Subject of Patch name"
Autosquash Rebase
Rebuild Patches
Rebasing Your PR
When you need to update your PR with the latest changes frommain:
origin is your fork and upstream is the official PaperMC repository.Fetch Upstream Changes
Rebase Your Branch
Apply Patches
Fix Conflicts
Ensure Patch Order (Feature Patches Only)
9999-Patch-to-add-some-new-stuff.patch) and re-apply patches.Option B: Run interactive rebase and move commits to the end:Rebuild Patches
Commit Modified Patches
Force Push
Access Transformers
Sometimes Vanilla code contains fields, methods, or types with insufficient visibility (e.g., private fields you need to access). Paper uses Access Transformers (ATs) to change visibility or remove final modifiers without directly patching every reference.Edit the AT File
build-data/paper.at and add your access transformer.Apply Patches