From 69326e361ab7d982a577f1e864c772967ad9c134 Mon Sep 17 00:00:00 2001 From: Rabbitminers Date: Mon, 3 Apr 2023 21:30:28 +0100 Subject: [PATCH] Fixed Default Values When Used Styles Are Removed --- .../java/com/simibubi/create/AllBogeyStyles.java | 15 +++++++++++++++ .../logistics/trains/entity/CarriageSounds.java | 4 ++-- .../trains/track/StandardBogeyTileEntity.java | 5 ++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/AllBogeyStyles.java b/src/main/java/com/simibubi/create/AllBogeyStyles.java index be789fdd7..c521b7a88 100644 --- a/src/main/java/com/simibubi/create/AllBogeyStyles.java +++ b/src/main/java/com/simibubi/create/AllBogeyStyles.java @@ -20,6 +20,21 @@ public class AllBogeyStyles { .renderer(new StandardBogeyRenderer()) .register(); + /* + public static final RegistryEntry TEST = REGISTRATE + .bogeyStyle("test", new BogeyStyle()) + .block(BogeySizes.LARGE, AllBlocks.LARGE_BOGEY) + .renderer(new TestBogeyRenderer()) + .register(); + + public static final RegistryEntry TEST_TWO = REGISTRATE + .bogeyStyle("test_two", new BogeyStyle()) + .block(BogeySizes.SMALL, AllBlocks.SMALL_BOGEY) + .renderer(new TestBogeyRenderer()) + .register(); + + */ + public static void register() { LOGGER.info("Registered bogey styles from " + Create.ID); AllRegistries.DEFERRED_BOGEY_REGISTRY.register(FMLJavaModLoadingContext.get().getModEventBus()); diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/entity/CarriageSounds.java b/src/main/java/com/simibubi/create/content/logistics/trains/entity/CarriageSounds.java index 56832e8ff..454cc406c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/entity/CarriageSounds.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/entity/CarriageSounds.java @@ -4,7 +4,6 @@ import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllSoundEvents.SoundEntry; import com.simibubi.create.content.logistics.trains.entity.Carriage.DimensionalCarriageEntity; import com.simibubi.create.foundation.utility.Couple; -import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser; @@ -43,7 +42,8 @@ public class CarriageSounds { this.entity = entity; bogeySounds = entity.getCarriage().bogeys.map(bogey -> bogey != null ? bogey.getStyle().getSoundType() - : AllSoundEvents.TRAIN2.getMainEvent()); + : AllSoundEvents.TRAIN2.getMainEvent()); + closestBogeySound = bogeySounds.getFirst(); distanceFactor = LerpedFloat.linear(); speedFactor = LerpedFloat.linear(); approachFactor = LerpedFloat.linear(); diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/track/StandardBogeyTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/trains/track/StandardBogeyTileEntity.java index 8077152e5..a6c9185bb 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/track/StandardBogeyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/track/StandardBogeyTileEntity.java @@ -56,7 +56,10 @@ public class StandardBogeyTileEntity extends CachedRenderBBTileEntity { CompoundTag data = this.getBogeyData(); ResourceLocation currentStyle = NBTHelper.readResourceLocation(data, BOGEY_STYLE_KEY); BogeyStyle style = AllRegistries.BOGEY_REGISTRY.get().getValue(currentStyle); - if (style == null) setBogeyStyle(AllBogeyStyles.STANDARD.get()); + if (style == null) { + setBogeyStyle(AllBogeyStyles.STANDARD.get()); + return getStyle(); + } return style; }