Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ public AbstractContraptionEntityMixin(final EntityType<?> arg, final Level arg2)
private void sable$contraptionInitialize(final CallbackInfo ci) {
if (!this.sable$added && this.level() instanceof final ServerLevel serverLevel) {
this.sable$buildProperties();
this.sable$addToPlot();
this.sable$addToPipeline(serverLevel);
if (this.sable$massTracker.getCenterOfMass() != null) {
this.sable$addToPlot();
this.sable$addToPipeline(serverLevel);
}
this.sable$added = true;
}
Comment on lines 99 to 106
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shi the AI overlord is right

}
Expand Down Expand Up @@ -164,9 +166,12 @@ public CompoundTag saveWithoutId(final CompoundTag nbt) {

assert this.sable$localBounds != null;
this.sable$massTracker = MassTracker.build(this.sable$blockGetter(), this.sable$localBounds);
final Vector3d temp = this.sable$massTracker.getCenterOfMass().negate(new Vector3d()).add(0.5, 0.5, 0.5);
for (final FloatingBlockCluster cluster : this.sable$floatingClusterContainer.clusters) {
cluster.getBlockData().translateOrigin(temp);
final Vector3dc centerOfMass = this.sable$massTracker.getCenterOfMass();
if (centerOfMass != null) {
final Vector3d temp = centerOfMass.negate(new Vector3d()).add(0.5, 0.5, 0.5);
for (final FloatingBlockCluster cluster : this.sable$floatingClusterContainer.clusters) {
cluster.getBlockData().translateOrigin(temp);
}
}
}

Expand Down