Skip to content

Commit

Permalink
fix potential crash
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Oct 26, 2024
1 parent 5511525 commit f60aea5
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ public class Carriage$DimensionalCarriageEntityMixin {

@Inject(method = "createEntity", at = @At("HEAD"))
private void railwaysTweaks$fixDimensionalTrainCrash(Level level, boolean loadPassengers, CallbackInfo ci) {
((CarriageAccessor) this$0).railwaysTweaks$getSerializedEntity().put(
"Pos",
railwaysTweaks$newDoubleList(
positionAnchor.x(),
positionAnchor.y(),
positionAnchor.z()
)
);
if (positionAnchor != null) {
((CarriageAccessor) this$0).railwaysTweaks$getSerializedEntity().put(
"Pos",
railwaysTweaks$newDoubleList(
positionAnchor.x(),
positionAnchor.y(),
positionAnchor.z()
)
);
}
}

@WrapWithCondition(method = "createEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;moveTo(Lnet/minecraft/world/phys/Vec3;)V"))
private boolean railwaysTweaks$fixDimensionalTrainCrash2(Entity instance, Vec3 vec) {
return false;
return positionAnchor != null;
}

@Unique
Expand Down

0 comments on commit f60aea5

Please sign in to comment.