Possible biome surface fix
This commit is contained in:
parent
3ceb8638d5
commit
c82e2900f6
2 changed files with 12 additions and 7 deletions
|
@ -11,7 +11,7 @@ loader_version= 0.12.8
|
||||||
fabric_version = 0.44.0+1.18
|
fabric_version = 0.44.0+1.18
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.0
|
mod_version = 1.0.1
|
||||||
maven_group = ru.bclib
|
maven_group = ru.bclib
|
||||||
archives_base_name = bclib
|
archives_base_name = bclib
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||||
|
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import ru.bclib.api.biomes.BiomeAPI;
|
import ru.bclib.api.biomes.BiomeAPI;
|
||||||
|
@ -16,6 +17,8 @@ import ru.bclib.util.WeightedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class BCLBiome {
|
public class BCLBiome {
|
||||||
private final List<ConfiguredStructureFeature> structures = Lists.newArrayList();
|
private final List<ConfiguredStructureFeature> structures = Lists.newArrayList();
|
||||||
|
@ -24,7 +27,7 @@ public class BCLBiome {
|
||||||
private final ResourceLocation biomeID;
|
private final ResourceLocation biomeID;
|
||||||
private final Biome biome;
|
private final Biome biome;
|
||||||
|
|
||||||
private SurfaceRules.RuleSource surface;
|
private Runnable surfaceInit;
|
||||||
private BCLBiome biomeParent;
|
private BCLBiome biomeParent;
|
||||||
private Biome actualBiome;
|
private Biome actualBiome;
|
||||||
private BCLBiome edge;
|
private BCLBiome edge;
|
||||||
|
@ -229,9 +232,8 @@ public class BCLBiome {
|
||||||
structures.forEach(s -> BiomeAPI.addBiomeStructure(BiomeAPI.getBiomeKey(actualBiome), s));
|
structures.forEach(s -> BiomeAPI.addBiomeStructure(BiomeAPI.getBiomeKey(actualBiome), s));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.surface!=null){
|
if (this.surfaceInit != null){
|
||||||
ResourceKey key = BiomeAPI.getBiomeKey(actualBiome);
|
surfaceInit.run();
|
||||||
BiomeAPI.addSurfaceRule(biomeID, SurfaceRules.ifTrue(SurfaceRules.isBiome(key), surface));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +319,10 @@ public class BCLBiome {
|
||||||
* Sets biome surface rule.
|
* Sets biome surface rule.
|
||||||
* @param surface {@link SurfaceRules.RuleSource} rule.
|
* @param surface {@link SurfaceRules.RuleSource} rule.
|
||||||
*/
|
*/
|
||||||
public void setSurface(SurfaceRules.RuleSource surface) {
|
public void setSurface(RuleSource surface) {
|
||||||
this.surface = surface;
|
this.surfaceInit = () -> {
|
||||||
|
ResourceKey key = BiomeAPI.getBiomeKey(biome);
|
||||||
|
BiomeAPI.addSurfaceRule(biomeID, SurfaceRules.ifTrue(SurfaceRules.isBiome(key), surface));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue