diff --git a/neoforge/src/main/java/dev/ryanhcode/sable/neoforge/mixin/compatibility/create/contraptions/AbstractContraptionEntityMixin.java b/neoforge/src/main/java/dev/ryanhcode/sable/neoforge/mixin/compatibility/create/contraptions/AbstractContraptionEntityMixin.java index a6661e82..10703a83 100644 --- a/neoforge/src/main/java/dev/ryanhcode/sable/neoforge/mixin/compatibility/create/contraptions/AbstractContraptionEntityMixin.java +++ b/neoforge/src/main/java/dev/ryanhcode/sable/neoforge/mixin/compatibility/create/contraptions/AbstractContraptionEntityMixin.java @@ -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; } } @@ -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); + } } }