1.0.9
All checks were successful
RelicCraft/pipeline/head This commit looks good

Fix Structure Generation Bug with Modded Biomes
This commit is contained in:
TheBrokenRail 2020-04-07 19:36:57 -04:00
parent f82ca29245
commit 0d55d8089d
5 changed files with 33 additions and 7 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.0.9**
* Fix Structure Generation Bug with Modded Biomes
**1.0.8** **1.0.8**
* Fix Lakes Cutting Off Time Temples * Fix Lakes Cutting Off Time Temples

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.7.10+build.191 fabric_loader_version = 0.7.10+build.191
# Mod Properties # Mod Properties
mod_version = 1.0.8 mod_version = 1.0.9
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
archives_base_name = reliccraft archives_base_name = reliccraft

View File

@ -121,8 +121,8 @@ public class RelicCraft implements ModInitializer {
world.playSound(null, pos, INTERACT_TELEPORT_RESTRICTOR_SOUND_EFFECT, SoundCategory.BLOCKS, 1.0f, 1.0f); world.playSound(null, pos, INTERACT_TELEPORT_RESTRICTOR_SOUND_EFFECT, SoundCategory.BLOCKS, 1.0f, 1.0f);
} }
public static StructureFeature<DefaultFeatureConfig> TIME_TEMPLE_STRUCTURE_FEATURE; public static StructureFeature<DefaultFeatureConfig> TIME_TEMPLE_STRUCTURE_FEATURE = new TimeTempleFeature(DefaultFeatureConfig::deserialize);
public static StructurePieceType TIME_TEMPLE_STRUCTURE_PIECE; public static StructurePieceType TIME_TEMPLE_STRUCTURE_PIECE = TimeTempleGenerator.Piece::new;
public static final String TIME_TEMPLE_ID = "RelicCraft Time Temple"; public static final String TIME_TEMPLE_ID = "RelicCraft Time Temple";
@Override @Override
@ -170,16 +170,15 @@ public class RelicCraft implements ModInitializer {
//noinspection ResultOfMethodCallIgnored //noinspection ResultOfMethodCallIgnored
TagRegistry.item(new Identifier(NAMESPACE, "items")); TagRegistry.item(new Identifier(NAMESPACE, "items"));
TIME_TEMPLE_STRUCTURE_PIECE = Registry.register(Registry.STRUCTURE_PIECE, new Identifier(NAMESPACE, "time_temple"), TimeTempleGenerator.Piece::new); Registry.register(Registry.STRUCTURE_PIECE, new Identifier(NAMESPACE, "time_temple"), TIME_TEMPLE_STRUCTURE_PIECE);
TIME_TEMPLE_STRUCTURE_FEATURE = Registry.register(Registry.FEATURE, new Identifier(NAMESPACE, "time_temple"), new TimeTempleFeature(DefaultFeatureConfig::deserialize)); 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); 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); 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) { for (Biome biome : Registry.BIOME) {
biome.addFeature(GenerationStep.Feature.SURFACE_STRUCTURES, configuredFeature);
if (biome.getCategory() == Biome.Category.PLAINS) { if (biome.getCategory() == Biome.Category.PLAINS) {
biome.addStructureFeature(TIME_TEMPLE_STRUCTURE_FEATURE.configure(FeatureConfig.DEFAULT)); 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.FEATURE_TO_FEATURE_CONFIG.put(configuredFeature, FeatureConfig.DEFAULT);
FlatChunkGeneratorConfig.STRUCTURE_TO_FEATURES.put(NAMESPACE + "_time_temple", new ConfiguredFeature[]{configuredFeature}); FlatChunkGeneratorConfig.STRUCTURE_TO_FEATURES.put(NAMESPACE + "_time_temple", new ConfiguredFeature[]{configuredFeature});
} }
public static ConfiguredFeature<?, ?> getConfiguredFeature(StructureFeature<DefaultFeatureConfig> feature) {
return feature.configure(FeatureConfig.DEFAULT).createDecoratedFeature(Decorator.NOPE.configure(DecoratorConfig.DEFAULT));
}
} }

View File

@ -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));
}
}

View File

@ -8,6 +8,7 @@
"mixins": [ "mixins": [
"CriteriaRegistryHook", "CriteriaRegistryHook",
"MixinBlockItem", "MixinBlockItem",
"MixinDefaultBiomeFeatures",
"MixinEnderDragonFight", "MixinEnderDragonFight",
"MixinEnderPearlItem", "MixinEnderPearlItem",
"MixinEntity", "MixinEntity",