-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Second Approach to Fix #5420 & #6988 #8907
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
base: mc1.20.1/dev
Are you sure you want to change the base?
Second Approach to Fix #5420 & #6988 #8907
Conversation
34af35a
to
8064502
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does look like a better solution to me (assuming it works), simply because there's no hardcoding every case, which will be more compatible with other mods and is less prone to breaking when a new feature is released.
Performance-wise this might perform slightly worse /w the level creation (but tbf that's only once per disassembly)
But kind reminder that the decision on what's better isn't mine to take (:
@@ -1144,6 +1144,8 @@ public void addBlocksToWorld(Level world, StructureTransform transform) { | |||
|
|||
translateMultiblockControllers(transform); | |||
|
|||
SingleBlockServerLevel popChamber = new SingleBlockServerLevel((ServerLevel) world); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is world
actually always a serverlevel here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, i was assuming so since you can't add entities (drop items) if not. I can probably change it also to create the level only on the first fail
8064502
to
88fc285
Compare
thanks for the remainder, but i'm taking you down to the rabbit hole nonetheless :P (I really appreciate your help). Made the changes, now it will only create the level wrapper the first time a block "fails" to be placed and only if it's a server level. I did kept the sound event for both cases since the overridden destroy I did in the wrapped level is silent (no event is called there). |
b99da53
to
db63d97
Compare
db63d97
to
0d275fc
Compare
fda6965
to
3c612fc
Compare
3c612fc
to
579758b
Compare
conflicts were resolved :) |
Changes added to fix also #6988 |
This is a second approach to solve #5420 (first one is #8774). This PR adds a Ghost Wrapper of ServelLevel to load the blocks and their entity data allowing for the full use of their .onRemove method when the block is deleted "virtually" dropping the block and it's content. The class is only instanced the first time is needed on the disassembly of a contraption. Also added the cases were is the target location isOutsideBuildHeight and when updateShape changes the state to AIR (solve #6988)