Skip to content

Commit

Permalink
bogey safety
Browse files Browse the repository at this point in the history
fix #985
  • Loading branch information
TropheusJ committed Jul 2, 2023
1 parent bbc4641 commit b2c3060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions FABRIC_CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Change logging starts below:
----------
- fix some blocks in copycats causing crashes (#988, #984, #971)
- fix pipe ponder crashing (#987, #970)
- added safety on train carriage loading (#985)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javax.annotation.Nullable;

import com.jozufozu.flywheel.api.MaterialManager;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBogeyStyles;
import com.simibubi.create.Create;
import com.simibubi.create.content.trains.bogey.AbstractBogeyBlock;
Expand Down Expand Up @@ -192,7 +193,8 @@ public CompoundTag write(DimensionPalette dimensions) {

public static CarriageBogey read(CompoundTag tag, TrackGraph graph, DimensionPalette dimensions) {
ResourceLocation location = new ResourceLocation(tag.getString("Type"));
AbstractBogeyBlock<?> type = (AbstractBogeyBlock<?>) Registry.BLOCK.get(location);
Block block = Registry.BLOCK.get(location);
AbstractBogeyBlock<?> type = block instanceof AbstractBogeyBlock<?> bogey ? bogey : AllBlocks.SMALL_BOGEY.get();
boolean upsideDown = tag.getBoolean("UpsideDown");
Couple<TravellingPoint> points = Couple.deserializeEach(tag.getList("Points", Tag.TAG_COMPOUND),
c -> TravellingPoint.read(c, graph, dimensions));
Expand Down

0 comments on commit b2c3060

Please sign in to comment.