Skip to content

Client block transformer #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 12, 2025
Merged

Client block transformer #26

merged 3 commits into from
May 12, 2025

Conversation

RecursivePineapple
Copy link
Contributor

@RecursivePineapple RecursivePineapple commented Apr 30, 2025

This adds a mechanism for modifying the blocks sent to the client. This is needed for situations where you want to show one block/meta to the player, while storing another on the server. While this doesn't entirely belong in NEID, it is tightly coupled to NEID's internals and it has several mixin conflicts with the NEID packet mixins. It isn't viable to move this to another mod.

Code changes:

  • Add the interface and registry (the registry is undocumented, but the interface should be 100% documented)
  • Intercept packet S23, which is sent when the player right clicks a block
  • Intercept packet S22, which is sent when 2-64 blocks change in a chunk
  • Intercept packets S21 and S26 (via the chunk data extractor method), which are sent when chunks significantly change or are loaded

Testing done:

  • Make a transformer that converts all sand to red sand
  • Make a transformer that converts sand to red sand when (x + y + z) % 2 == 0
  • Create a new default world and make sure the conversion works
  • Create a superflat world that consists of ~6 layers of sand (no structures), turn off mobs, and profile it while flying around (https://spark.lucko.me/eZ8SVcHV99 - I can't even find the code on here)
  • Test it in the full pack in SP (sand change only)
  • Integrate it with GT coils
  • Test on MP (in GT5u):
    • Make an EBF and turn it on
    • Relog within its chunk
    • Use MM to change more than 64 blocks at once in its chunk
    • With a small render distance and while the EBF is on, move a few chunks away so that it unloads and move back
    • Do the same, but relog while outside of its range
    • Chunkload the EBF and leave+enter its range

image
image

@RecursivePineapple RecursivePineapple added the enhancement New feature or request label Apr 30, 2025
@RecursivePineapple RecursivePineapple requested review from Cleptomania and a team April 30, 2025 16:51
@mitchej123
Copy link
Contributor

Has this been tested on both SP + MP?

@RecursivePineapple
Copy link
Contributor Author

No, I forgot to test it before I put up the PR, but I did test it in the full pack

@mitchej123
Copy link
Contributor

SP and MP behave differently when it comes to packets.

@Dream-Master
Copy link
Member

i not add it to nightlies yet but will do after test

@RecursivePineapple
Copy link
Contributor Author

It works fine on MP, I'll update the PR with everything I tested

2025-04-30_13 08 55

@serenibyss serenibyss removed the 🚧 Testing on Zeta Do not merge yet, testing this PR on Zeta label May 12, 2025
@serenibyss serenibyss merged commit 1645b91 into master May 12, 2025
2 checks passed
@serenibyss serenibyss deleted the client-block-transformer branch May 12, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants