diff --git a/CHANGELOG.md b/CHANGELOG.md index abfd229..8002bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +**1.0.9** +* Fix Structure Generation Bug with Modded Biomes + **1.0.8** * Fix Lakes Cutting Off Time Temples diff --git a/gradle.properties b/gradle.properties index e764c91..e39fc9d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G fabric_loader_version = 0.7.10+build.191 # Mod Properties - mod_version = 1.0.8 + mod_version = 1.0.9 maven_group = com.thebrokenrail archives_base_name = reliccraft diff --git a/src/main/java/com/thebrokenrail/reliccraft/RelicCraft.java b/src/main/java/com/thebrokenrail/reliccraft/RelicCraft.java index ef7b888..089063b 100644 --- a/src/main/java/com/thebrokenrail/reliccraft/RelicCraft.java +++ b/src/main/java/com/thebrokenrail/reliccraft/RelicCraft.java @@ -121,8 +121,8 @@ public class RelicCraft implements ModInitializer { world.playSound(null, pos, INTERACT_TELEPORT_RESTRICTOR_SOUND_EFFECT, SoundCategory.BLOCKS, 1.0f, 1.0f); } - public static StructureFeature TIME_TEMPLE_STRUCTURE_FEATURE; - public static StructurePieceType TIME_TEMPLE_STRUCTURE_PIECE; + public static StructureFeature TIME_TEMPLE_STRUCTURE_FEATURE = new TimeTempleFeature(DefaultFeatureConfig::deserialize); + public static StructurePieceType TIME_TEMPLE_STRUCTURE_PIECE = TimeTempleGenerator.Piece::new; public static final String TIME_TEMPLE_ID = "RelicCraft Time Temple"; @Override @@ -170,16 +170,15 @@ public class RelicCraft implements ModInitializer { //noinspection ResultOfMethodCallIgnored TagRegistry.item(new Identifier(NAMESPACE, "items")); - TIME_TEMPLE_STRUCTURE_PIECE = Registry.register(Registry.STRUCTURE_PIECE, new Identifier(NAMESPACE, "time_temple"), TimeTempleGenerator.Piece::new); - TIME_TEMPLE_STRUCTURE_FEATURE = Registry.register(Registry.FEATURE, new Identifier(NAMESPACE, "time_temple"), new TimeTempleFeature(DefaultFeatureConfig::deserialize)); + Registry.register(Registry.STRUCTURE_PIECE, new Identifier(NAMESPACE, "time_temple"), TIME_TEMPLE_STRUCTURE_PIECE); + Registry.register(Registry.FEATURE, new Identifier(NAMESPACE, "time_temple"), TIME_TEMPLE_STRUCTURE_FEATURE); Registry.register(Registry.STRUCTURE_FEATURE, new Identifier(NAMESPACE, "time_temple"), TIME_TEMPLE_STRUCTURE_FEATURE); Feature.STRUCTURES.put(TIME_TEMPLE_ID.toLowerCase(Locale.ROOT), TIME_TEMPLE_STRUCTURE_FEATURE); - ConfiguredFeature configuredFeature = TIME_TEMPLE_STRUCTURE_FEATURE.configure(FeatureConfig.DEFAULT).createDecoratedFeature(Decorator.NOPE.configure(DecoratorConfig.DEFAULT)); + ConfiguredFeature configuredFeature = getConfiguredFeature(TIME_TEMPLE_STRUCTURE_FEATURE); for (Biome biome : Registry.BIOME) { - biome.addFeature(GenerationStep.Feature.SURFACE_STRUCTURES, configuredFeature); if (biome.getCategory() == Biome.Category.PLAINS) { biome.addStructureFeature(TIME_TEMPLE_STRUCTURE_FEATURE.configure(FeatureConfig.DEFAULT)); } @@ -189,4 +188,8 @@ public class RelicCraft implements ModInitializer { FlatChunkGeneratorConfig.FEATURE_TO_FEATURE_CONFIG.put(configuredFeature, FeatureConfig.DEFAULT); FlatChunkGeneratorConfig.STRUCTURE_TO_FEATURES.put(NAMESPACE + "_time_temple", new ConfiguredFeature[]{configuredFeature}); } + + public static ConfiguredFeature getConfiguredFeature(StructureFeature feature) { + return feature.configure(FeatureConfig.DEFAULT).createDecoratedFeature(Decorator.NOPE.configure(DecoratorConfig.DEFAULT)); + } } diff --git a/src/main/java/com/thebrokenrail/reliccraft/mixin/MixinDefaultBiomeFeatures.java b/src/main/java/com/thebrokenrail/reliccraft/mixin/MixinDefaultBiomeFeatures.java new file mode 100644 index 0000000..9034241 --- /dev/null +++ b/src/main/java/com/thebrokenrail/reliccraft/mixin/MixinDefaultBiomeFeatures.java @@ -0,0 +1,19 @@ +package com.thebrokenrail.reliccraft.mixin; + +import com.thebrokenrail.reliccraft.RelicCraft; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.DefaultBiomeFeatures; +import net.minecraft.world.gen.GenerationStep; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@SuppressWarnings("unused") +@Mixin(DefaultBiomeFeatures.class) +public class MixinDefaultBiomeFeatures { + @Inject(at = @At("RETURN"), method = "addDefaultStructures") + private static void addDefaultStructures(Biome biome, CallbackInfo info) { + biome.addFeature(GenerationStep.Feature.SURFACE_STRUCTURES, RelicCraft.getConfiguredFeature(RelicCraft.TIME_TEMPLE_STRUCTURE_FEATURE)); + } +} diff --git a/src/main/resources/reliccraft.mixins.json b/src/main/resources/reliccraft.mixins.json index 26636b9..e7008b1 100644 --- a/src/main/resources/reliccraft.mixins.json +++ b/src/main/resources/reliccraft.mixins.json @@ -8,6 +8,7 @@ "mixins": [ "CriteriaRegistryHook", "MixinBlockItem", + "MixinDefaultBiomeFeatures", "MixinEnderDragonFight", "MixinEnderPearlItem", "MixinEntity",