Skip to content

Second Approach to Fix #5420 #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

Open
wants to merge 1 commit into
base: mc1.20.1/dev
Choose a base branch
from

Conversation

Allmoz
Copy link
Contributor

@Allmoz Allmoz commented Jul 11, 2025

This is a second approach to solve #5420 (first one is #8774). In this case, blocks are actually loaded on a wrapped servel level (that can contain only 1 block) to be able to use .onRemove on them. This should be a more general solution, but i don't know if is less performant. @VoidLeech is this better?

@Allmoz Allmoz force-pushed the contraption_container_reloaded branch 4 times, most recently from 34af35a to 8064502 Compare July 11, 2025 09:43
@VoidLeech VoidLeech added the pr type: fix PR fixes a bug label Jul 11, 2025
Copy link
Collaborator

@VoidLeech VoidLeech left a 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);
Copy link
Collaborator

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?

Copy link
Contributor Author

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

@Allmoz Allmoz force-pushed the contraption_container_reloaded branch from 8064502 to 88fc285 Compare July 11, 2025 22:18
@Allmoz
Copy link
Contributor Author

Allmoz commented Jul 11, 2025

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr type: fix PR fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants