Keep one FakePlayer per robot if the cost is real: measure first

Open
#287 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
performance

Research direction

Start at RobotManager.fakePlayer, the loader call that builds a FakePlayer per action, and check where advancement listeners are registered on creation. First task is measurement, not code: run a program that builds for several minutes under both Fabric and NeoForge and count FakePlayer creations per owner, reusing the GameTest profiling setup mentioned here. Only if it is recreated should the FakePlayer be cached, with its lifetime tied to robot load, level change and server stop, leaving #246's contract and claim protection untouched.

Written by the indexing model from the issue text.

Description

area: server enhancement P3

Job to be done

When my robot builds and breaks blocks, I want each action to be cheap, so the server stays smooth.

Player value

Less server work for programs that build.

What the code says today (develop, 2026-11-24)

  • RobotManager.fakePlayer asks the loader for a FakePlayer for every action. Creating one registers its advancement listeners.
  • Measured on a laptop (i7-12800H) on 2026-11-24. A Java profile of four GameTest runs had about 11 percent of the robot executor's samples in creating FakePlayers.
  • Part of that is the tests themselves: every test has new owners, so each needs a new FakePlayer. Whether it is created again for the same owner in normal play is not measured.

Acceptance criteria

  • Measured first: how often a FakePlayer is created for one owner who builds for several minutes, on Fabric and NeoForge.
  • If it is created only once, the issue is closed with the numbers.
  • Otherwise: it is kept while the robot is loaded, and let go when the robot unloads, the level changes or the server stops. No level is kept in memory.
  • The FakePlayer contract (#246) and claim protection are unchanged.

Parent: #50
Priority: P3

Dominant language
Java
Stars
0
Forks
1
Avg merge
1h 29m
Merged PRs (30d)
42

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from halisonworks/mod-codeling

All issues in halisonworks/mod-codeling

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.