Add Photographer API for .mcpr recording (Foliaphotographer-style) #444

Open
xiaofanforfabric wants to merge 2 commits from xiaofanforfabric/ver/1.21.4-PhotographerAPI into ver/1.21.4
xiaofanforfabric commented 2026-02-20 10:59:25 +01:00 (Migrated from github.com)

Summary

This PR adds a Photographer API to Folia so the server can record gameplay as .mcpr replays (ReplayMod-compatible). Plugins can create "photographer" entities that mirror a player, capture network packets, and write them to a .mcpr file when recording stops.

Motivation

  • Recording on Folia: Servers (e.g. anti-cheat, moderation, replay) need a way to record players as .mcpr without a client-side ReplayMod. Leaves and some other cores already provide a Photographer API; this brings the same capability to Folia.
  • Plugin compatibility: The API is aligned with the existing "photographer" concept (e.g. Leaves), so plugins like ISeeYou (Folia) can support Folia with minimal changes.

Main changes

Area Description
API (folia-api) New interfaces: PhotographerManager, Photographer, BukkitRecorderOption. Server exposes Server#getPhotographerManager().
Server implementation ServerPhotographer (fake player), Recorder, ReplayFile, CraftPhotographerManager. Records packets to a temp dir and packs to .mcpr on stop.
PlayerList realPlayers list, placeNewPhotographer(), removePhotographer(). Photographers do not consume real player slots.
CraftServer / events getPhotographerManager(); CraftEntity maps ServerPhotographerCraftPhotographer; player events skip photographers.
Folia threading ServerPhotographer#tick() uses a local tick counter instead of MinecraftServer.getTickCount() (which is not available on Folia).

Testing

  • Built with createMojmapPaperclipJar, started server, loaded FoliaISEEYOU. Recording starts on player join and saves .mcpr on quit; replay plays correctly in ReplayMod.

Notes

  • Patches are structured for the existing Folia/Paper patch flow (e.g. paper-patches and minecraft-patches). Happy to adjust to upstream conventions or split into smaller PRs if preferred.
## Summary This PR adds a **Photographer API** to Folia so the server can record gameplay as **.mcpr** replays (ReplayMod-compatible). Plugins can create "photographer" entities that mirror a player, capture network packets, and write them to a .mcpr file when recording stops. ## Motivation - **Recording on Folia**: Servers (e.g. anti-cheat, moderation, replay) need a way to record players as .mcpr without a client-side ReplayMod. Leaves and some other cores already provide a Photographer API; this brings the same capability to Folia. - **Plugin compatibility**: The API is aligned with the existing "photographer" concept (e.g. Leaves), so plugins like [ISeeYou (Folia)](https://github.com/xiaofanforfabric/FoliaISEEYOU) can support Folia with minimal changes. ## Main changes | Area | Description | |------|-------------| | **API (folia-api)** | New interfaces: `PhotographerManager`, `Photographer`, `BukkitRecorderOption`. Server exposes `Server#getPhotographerManager()`. | | **Server implementation** | `ServerPhotographer` (fake player), `Recorder`, `ReplayFile`, `CraftPhotographerManager`. Records packets to a temp dir and packs to .mcpr on stop. | | **PlayerList** | `realPlayers` list, `placeNewPhotographer()`, `removePhotographer()`. Photographers do not consume real player slots. | | **CraftServer / events** | `getPhotographerManager()`; CraftEntity maps `ServerPhotographer` → `CraftPhotographer`; player events skip photographers. | | **Folia threading** | `ServerPhotographer#tick()` uses a local tick counter instead of `MinecraftServer.getTickCount()` (which is not available on Folia). | ## Testing - Built with `createMojmapPaperclipJar`, started server, loaded [FoliaISEEYOU](https://github.com/xiaofanforfabric/FoliaISEEYOU). Recording starts on player join and saves .mcpr on quit; replay plays correctly in ReplayMod. ## Notes - Patches are structured for the existing Folia/Paper patch flow (e.g. paper-patches and minecraft-patches). Happy to adjust to upstream conventions or split into smaller PRs if preferred.
Q2297045667 commented 2026-02-20 11:06:18 +01:00 (Migrated from github.com)

不是,你往这里放啥呀?
他又不可能合并你的pr😂这种功能就没必要拉上来了吧?他不可能合并的。

不是,你往这里放啥呀? 他又不可能合并你的pr😂这种功能就没必要拉上来了吧?他不可能合并的。
xiaofanforfabric commented 2026-02-20 11:24:00 +01:00 (Migrated from github.com)

我去,好像提交错地方了,我应该提到我的仓库的1.21.4分支的

我去,好像提交错地方了,我应该提到我的仓库的1.21.4分支的
virgil698 commented 2026-02-20 11:26:12 +01:00 (Migrated from github.com)

没绷住

没绷住
xiaofanforfabric commented 2026-02-20 11:36:26 +01:00 (Migrated from github.com)

管他呢,爱合并不合并

管他呢,爱合并不合并
Fawe00 commented 2026-02-20 18:18:05 +01:00 (Migrated from github.com)

⚠️ Security & License Concerns - Compiled .class Files Should Not Be Committed
To the maintainers (@PaperMC team):
I recommend not merging this PR in its current state due to serious concerns about binary files and GPL compliance.
To the PR author (@xiaofanforfabric):
Thank you for your contribution, but there are some critical issues that need to be addressed:
🔴 Problems:

24 compiled .class files are being committed to the repository

Binary files like .class should never be in version control
They are automatically generated during the build process
They belong in .gitignore, not in the repository

GPL License violation concern

The GPL requires source code transparency
Committing pre-compiled binaries without a verifiable build process contradicts open-source principles
Users cannot verify if the .class files actually match the provided .java source code

Security risk

Pre-compiled .class files could contain malicious bytecode not visible in the source
There's no way to verify the binaries match the source code
This creates a potential attack vector

Build artifacts shouldn't be in git

Files in bin/main/ are build outputs
These should be generated locally via ./gradlew build, not committed

Required changes:

Remove all .class files from the commit
Add proper .gitignore rules for bin/, build/, and *.class
Only commit source files (.java, .patch, build scripts)
Let the Gradle build process generate .class files locally

⚠️ Security & License Concerns - Compiled .class Files Should Not Be Committed To the maintainers (@PaperMC team): I recommend not merging this PR in its current state due to serious concerns about binary files and GPL compliance. To the PR author (@xiaofanforfabric): Thank you for your contribution, but there are some critical issues that need to be addressed: 🔴 Problems: 24 compiled .class files are being committed to the repository Binary files like .class should never be in version control They are automatically generated during the build process They belong in .gitignore, not in the repository GPL License violation concern The GPL requires source code transparency Committing pre-compiled binaries without a verifiable build process contradicts open-source principles Users cannot verify if the .class files actually match the provided .java source code Security risk Pre-compiled .class files could contain malicious bytecode not visible in the source There's no way to verify the binaries match the source code This creates a potential attack vector Build artifacts shouldn't be in git Files in bin/main/ are build outputs These should be generated locally via ./gradlew build, not committed ✅ Required changes: Remove all .class files from the commit Add proper .gitignore rules for bin/, build/, and *.class Only commit source files (.java, .patch, build scripts) Let the Gradle build process generate .class files locally
Dueris commented 2026-02-20 18:38:22 +01:00 (Migrated from github.com)

Holy AI... both semi in code and in comments

This is out of scope of Folias intentions and goals, and most likely will not get merged, along with the fact that there are changes in the README too..??? And weird new MD files??? And compiled class files???

Out of scope, I don't think this would rly ever be merged, especially given this seems to be doing a lot more than just a Photographer API, like calling it a Folia fork in the unneeded README changes... when being PRed to merge with Folia?? And the insanely long debug file??

Holy AI... both semi in code and in comments This is out of scope of Folias intentions and goals, and most likely will not get merged, along with the fact that there are changes in the README too..??? And weird new MD files??? And compiled class files??? Out of scope, I don't think this would rly ever be merged, especially given this seems to be doing a lot more than just a Photographer API, like calling it a Folia fork in the unneeded README changes... when being PRed to merge with Folia?? And the insanely long debug file??
xiaofanforfabric commented 2026-02-20 18:57:01 +01:00 (Migrated from github.com)

这本来就是一个错误的拉取请求,本意是要合并到我的项目,结果不知为何拉到了paperMC官方的项目,我了解不会合并的,我不在意
This was originally an erroneous pull request. The intention was to merge it into my own project, but for some reason it was submitted to the PaperMC official repository. I understand it won’t be merged, and I don’t mind.

这本来就是一个错误的拉取请求,本意是要合并到我的项目,结果不知为何拉到了paperMC官方的项目,我了解不会合并的,我不在意 This was originally an erroneous pull request. The intention was to merge it into my own project, but for some reason it was submitted to the PaperMC official repository. I understand it won’t be merged, and I don’t mind.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin xiaofanforfabric/ver/1.21.4-PhotographerAPI:xiaofanforfabric/ver/1.21.4-PhotographerAPI
git switch xiaofanforfabric/ver/1.21.4-PhotographerAPI

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch ver/1.21.4
git merge --no-ff xiaofanforfabric/ver/1.21.4-PhotographerAPI
git switch xiaofanforfabric/ver/1.21.4-PhotographerAPI
git rebase ver/1.21.4
git switch ver/1.21.4
git merge --ff-only xiaofanforfabric/ver/1.21.4-PhotographerAPI
git switch xiaofanforfabric/ver/1.21.4-PhotographerAPI
git rebase ver/1.21.4
git switch ver/1.21.4
git merge --no-ff xiaofanforfabric/ver/1.21.4-PhotographerAPI
git switch ver/1.21.4
git merge --squash xiaofanforfabric/ver/1.21.4-PhotographerAPI
git switch ver/1.21.4
git merge --ff-only xiaofanforfabric/ver/1.21.4-PhotographerAPI
git switch ver/1.21.4
git merge xiaofanforfabric/ver/1.21.4-PhotographerAPI
git push origin ver/1.21.4
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Minecraft/Folia!444
No description provided.