Skip to content
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

Crash with oritech enderic laser due to missing ServerPlayerEntity instance checks. #661

Closed
Rearth opened this issue Mar 13, 2025 · 7 comments
Labels
bug Something isn't working

Comments

@Rearth
Copy link

Rearth commented Mar 13, 2025

Describe the bug
Hi, Oritech dev here. This bug was reported to me here: Rearth/Oritech#293
In Oritech there are machines that can kill entities, and have a custom class extender PlayerEntity as the killing entity set. The damagehandler class here: https://github.com/Caltinor/Project-MMO-2.0/blob/main/src/main/java/harmonised/pmmo/events/impl/DamageDealtHandler.java#L104 casts any playerentity on the server to a serverentity, which leads to a crash here. An additional instance check should be added in this method.

Expected behavior
Entity instance is checked to avoid crash.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions:

  • Minecraft: 1.21.1
  • Loader: Neoforge
  • Project MMO version pmmo-1.21.1-2.6.24

Additional context
Add any other context about the problem here.

@Caltinor
Copy link
Owner

@Rearth is there a reason why your block entity doesn't extend FakePlayer? It is my understanding that is the standard method for simulating player-like behavior when not using an actual player. I ask because this is something i do check for due to things like Create's Deployer, which have similar behavior.

@Saintdane69
Copy link

@Rearth @Caltinor would re-coding the laser as a FakePlayer similar to how the mob masher is handled from Mob Grinding Utils

example below

example mob utils FakePlayer Handler.txt

@Caltinor
Copy link
Owner

that would be my assumption. since the Forge FakePlayer is also an extension of ServerPlayer and you don't want BE behavior happening on the client outside of rendering for cheating purposes, it makes sense to extend this instead of the common-level player class. I say that from a purely theoretical position though because i do not know what the Oritech machines are doing at a technical level to know if this is the correct and practical solution.

@KaydenXzilon
Copy link

is there a way for us to exclude the oritech laser via some sort of config file?, I really want to put oritech and PMMO on our modpack so that mechanism isn't the prominent tech mod in the pack. any guidance would be appreciated.

@Caltinor
Copy link
Owner

@KaydenXzilon , unfortunately there is not. Because Oritech is emulating an actual player class to perform block behavior, there is no way for pmmo to differentiate between a real player and this block. This is why the FakePlayers exist in the first place.

@Rearth
Copy link
Author

Rearth commented Mar 21, 2025

Hi, sorry for the late response, missed the notifications here. I didn't actually know the fake player was a thing, and the custom player class was working pretty well.
However since Oritech is a multiloader mod using architectury, the solution on Oritechs side would be a bit more complicated. Fabric also has a fake player available, but Architectury does not, meaning I'd have to add loader specific code in each subproject and then reference that in the common code again, which always is annoying and brings other issues with it. Considering that this here is the only issue with this, the effort of fixing this on Oritechs side is not worth it to me.
Feel free to close this issue. I'd be happy to see the instance check I mentioned in the beginning added to pmmo (it should be a very small change), but I also can't expect you guys to work around me just because I'm using a multiloader setup.

@Caltinor
Copy link
Owner

@Rearth I am surprised that the call to isClientSide() isn't detecting whether the world you are instantiating your anonymous player class with. In any case i will change the side-test condition to more explicitly look for server player classes, which should fix this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants