Merge branch 'master' of https://github.com/paulevsGitch/BetterEnd
This commit is contained in:
commit
58a5d37121
9 changed files with 75 additions and 30 deletions
|
@ -35,7 +35,6 @@ public class BackgroundRendererMixin {
|
||||||
//private static final float SKY_RED = 21F / 255F;
|
//private static final float SKY_RED = 21F / 255F;
|
||||||
//private static final float SKY_GREEN = 16F / 255F;
|
//private static final float SKY_GREEN = 16F / 255F;
|
||||||
//private static final float SKY_BLUE = 20F / 255F;
|
//private static final float SKY_BLUE = 20F / 255F;
|
||||||
private static final float NORMAL = 1.5F/ 0.12757292F; // 0.12757292F is max value for red channel after all transformations
|
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private static float red;
|
private static float red;
|
||||||
|
@ -59,9 +58,9 @@ public class BackgroundRendererMixin {
|
||||||
}
|
}
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
//RenderSystem.clearColor(SKY_RED, SKY_GREEN, SKY_BLUE, 0);
|
//RenderSystem.clearColor(SKY_RED, SKY_GREEN, SKY_BLUE, 0);
|
||||||
red *= NORMAL;
|
red *= 4;
|
||||||
green *= NORMAL;
|
green *= 4;
|
||||||
blue *= NORMAL;
|
blue *= 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.util.registry.BuiltinRegistries;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.biome.Biome.Category;
|
||||||
import net.minecraft.world.biome.BiomeKeys;
|
import net.minecraft.world.biome.BiomeKeys;
|
||||||
import ru.betterend.world.biome.BiomeFoggyMushroomland;
|
import ru.betterend.world.biome.BiomeFoggyMushroomland;
|
||||||
import ru.betterend.world.biome.EndBiome;
|
import ru.betterend.world.biome.EndBiome;
|
||||||
|
@ -33,10 +34,22 @@ public class BiomeRegistry {
|
||||||
|
|
||||||
public static void mutateRegistry(Registry<Biome> biomeRegistry) {
|
public static void mutateRegistry(Registry<Biome> biomeRegistry) {
|
||||||
BiomeRegistry.MUTABLE.clear();
|
BiomeRegistry.MUTABLE.clear();
|
||||||
|
LAND_BIOMES.clearMutables();
|
||||||
|
|
||||||
for (EndBiome biome : BiomeRegistry.LAND_BIOMES.getBiomes())
|
for (EndBiome biome : BiomeRegistry.LAND_BIOMES.getBiomes())
|
||||||
BiomeRegistry.MUTABLE.put(biomeRegistry.getOrThrow(BiomeRegistry.getBiomeKey(biome)), biome);
|
BiomeRegistry.MUTABLE.put(biomeRegistry.getOrThrow(BiomeRegistry.getBiomeKey(biome)), biome);
|
||||||
for (EndBiome biome : BiomeRegistry.VOID_BIOMES.getBiomes())
|
for (EndBiome biome : BiomeRegistry.VOID_BIOMES.getBiomes())
|
||||||
BiomeRegistry.MUTABLE.put(biomeRegistry.getOrThrow(BiomeRegistry.getBiomeKey(biome)), biome);
|
BiomeRegistry.MUTABLE.put(biomeRegistry.getOrThrow(BiomeRegistry.getBiomeKey(biome)), biome);
|
||||||
|
|
||||||
|
biomeRegistry.forEach((biome) -> {
|
||||||
|
if (biome.getCategory() == Category.THEEND) {
|
||||||
|
if (!MUTABLE.containsKey(biome) && !biomeRegistry.getId(biome).getNamespace().equals("minecraft")) {
|
||||||
|
EndBiome endBiome = new EndBiome(biome);
|
||||||
|
LAND_BIOMES.addBiomeMutable(endBiome);
|
||||||
|
KEYS.put(endBiome, biomeRegistry.getKey(biome).get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EndBiome registerBiome(RegistryKey<Biome> key, BiomeType type, boolean addToGen) {
|
public static EndBiome registerBiome(RegistryKey<Biome> key, BiomeType type, boolean addToGen) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import ru.betterend.world.features.StoneSpiralFeature;
|
||||||
|
|
||||||
public class FeatureRegistry {
|
public class FeatureRegistry {
|
||||||
public static final EndFeature STONE_SPIRAL = new EndFeature("stone_spiral", new StoneSpiralFeature(), 2);
|
public static final EndFeature STONE_SPIRAL = new EndFeature("stone_spiral", new StoneSpiralFeature(), 2);
|
||||||
public static final EndFeature END_LAKE = new EndFeature("end_lake", new EndLakeFeature());
|
public static final EndFeature END_LAKE = EndFeature.MakeRawGenFeature("end_lake", new EndLakeFeature(), 100);
|
||||||
|
|
||||||
public static void register() {}
|
public static void register() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class BiomeDefinition {
|
||||||
private float fogDensity = 1F;
|
private float fogDensity = 1F;
|
||||||
|
|
||||||
private final Identifier id;
|
private final Identifier id;
|
||||||
|
private float genChance = 1F;
|
||||||
|
|
||||||
private ConfiguredSurfaceBuilder<?> surface;
|
private ConfiguredSurfaceBuilder<?> surface;
|
||||||
|
|
||||||
|
@ -86,6 +87,11 @@ public class BiomeDefinition {
|
||||||
this.particleConfig = config;
|
this.particleConfig = config;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BiomeDefinition setGenChance(float genChance) {
|
||||||
|
this.genChance = genChance;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public BiomeDefinition addMobSpawn(EntityType<?> type, int weight, int minGroupSize, int maxGroupSize) {
|
public BiomeDefinition addMobSpawn(EntityType<?> type, int weight, int minGroupSize, int maxGroupSize) {
|
||||||
Identifier eID = Registry.ENTITY_TYPE.getId(type);
|
Identifier eID = Registry.ENTITY_TYPE.getId(type);
|
||||||
|
@ -223,4 +229,8 @@ public class BiomeDefinition {
|
||||||
public float getFodDensity() {
|
public float getFodDensity() {
|
||||||
return fogDensity;
|
return fogDensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getGenChance() {
|
||||||
|
return genChance;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ public class BiomeFoggyMushroomland extends EndBiome {
|
||||||
.setWaterColor(119, 227, 250)
|
.setWaterColor(119, 227, 250)
|
||||||
.setWaterFogColor(119, 227, 250)
|
.setWaterFogColor(119, 227, 250)
|
||||||
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
|
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
|
||||||
.addFeature(FeatureRegistry.STONE_SPIRAL)
|
.addFeature(FeatureRegistry.END_LAKE)
|
||||||
.addFeature(FeatureRegistry.END_LAKE));
|
.addFeature(FeatureRegistry.STONE_SPIRAL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class EndBiome {
|
||||||
|
|
||||||
protected EndBiome biomeParent;
|
protected EndBiome biomeParent;
|
||||||
protected float maxSubBiomeChance = 1;
|
protected float maxSubBiomeChance = 1;
|
||||||
|
protected final float genChanceUnmutable;
|
||||||
protected float genChance = 1;
|
protected float genChance = 1;
|
||||||
|
|
||||||
private final float fogDensity;
|
private final float fogDensity;
|
||||||
|
@ -29,12 +30,14 @@ public class EndBiome {
|
||||||
biome = definition.build();
|
biome = definition.build();
|
||||||
mcID = definition.getID();
|
mcID = definition.getID();
|
||||||
fogDensity = definition.getFodDensity();
|
fogDensity = definition.getFodDensity();
|
||||||
|
genChanceUnmutable = definition.getGenChance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EndBiome(Biome biome) {
|
public EndBiome(Biome biome) {
|
||||||
this.biome = biome;
|
this.biome = biome;
|
||||||
mcID = BuiltinRegistries.BIOME.getId(biome);
|
mcID = BuiltinRegistries.BIOME.getId(biome);
|
||||||
fogDensity = 1;
|
fogDensity = 1;
|
||||||
|
genChanceUnmutable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void genSurfColumn(WorldAccess world, BlockPos pos, Random random) {
|
public void genSurfColumn(WorldAccess world, BlockPos pos, Random random) {
|
||||||
|
@ -106,6 +109,7 @@ public class EndBiome {
|
||||||
}
|
}
|
||||||
|
|
||||||
public float setGenChance(float chance) {
|
public float setGenChance(float chance) {
|
||||||
|
genChance = genChanceUnmutable;
|
||||||
genChance += chance;
|
genChance += chance;
|
||||||
return genChance;
|
return genChance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.util.registry.BuiltinRegistries;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.gen.GenerationStep;
|
import net.minecraft.world.gen.GenerationStep;
|
||||||
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
|
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
|
||||||
import net.minecraft.world.gen.decorator.ConfiguredDecorator;
|
|
||||||
import net.minecraft.world.gen.decorator.Decorator;
|
import net.minecraft.world.gen.decorator.Decorator;
|
||||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||||
import net.minecraft.world.gen.feature.ConfiguredFeatures;
|
import net.minecraft.world.gen.feature.ConfiguredFeatures;
|
||||||
|
@ -19,11 +18,11 @@ public class EndFeature {
|
||||||
private final ConfiguredFeature<?, ?> featureConfigured;
|
private final ConfiguredFeature<?, ?> featureConfigured;
|
||||||
private final GenerationStep.Feature featureStep;
|
private final GenerationStep.Feature featureStep;
|
||||||
|
|
||||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature, GenerationStep.Feature featureStep, ConfiguredDecorator<?> configuredDecorator) {
|
public EndFeature(String name, Feature<DefaultFeatureConfig> feature, GenerationStep.Feature featureStep, ConfiguredFeature<?, ?> configuredFeature) {
|
||||||
Identifier id = new Identifier(BetterEnd.MOD_ID, name);
|
Identifier id = new Identifier(BetterEnd.MOD_ID, name);
|
||||||
this.featureStep = featureStep;
|
this.featureStep = featureStep;
|
||||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configure(FeatureConfig.DEFAULT).decorate(configuredDecorator));
|
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, configuredFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature) {
|
public EndFeature(String name, Feature<DefaultFeatureConfig> feature) {
|
||||||
|
@ -40,6 +39,11 @@ public class EndFeature {
|
||||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(density));
|
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(density));
|
||||||
//return new EndFeature(name, feature, GenerationStep.Feature.VEGETAL_DECORATION, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(4));
|
//return new EndFeature(name, feature, GenerationStep.Feature.VEGETAL_DECORATION, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EndFeature MakeRawGenFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||||
|
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT).decorate(Decorator.CHANCE.configure(new ChanceDecoratorConfig(100)));
|
||||||
|
return new EndFeature(name, feature, GenerationStep.Feature.RAW_GENERATION, configured);
|
||||||
|
}
|
||||||
|
|
||||||
public Feature<DefaultFeatureConfig> getFeature() {
|
public Feature<DefaultFeatureConfig> getFeature() {
|
||||||
return feature;
|
return feature;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import ru.betterend.util.BlocksHelper;
|
||||||
import ru.betterend.util.MHelper;
|
import ru.betterend.util.MHelper;
|
||||||
|
|
||||||
public class EndLakeFeature extends DefaultFeature {
|
public class EndLakeFeature extends DefaultFeature {
|
||||||
|
private static final BlockState END_STONE = Blocks.END_STONE.getDefaultState();
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
||||||
private static final Mutable POS = new Mutable();
|
private static final Mutable POS = new Mutable();
|
||||||
|
|
||||||
|
@ -46,23 +47,6 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
if (pos.getY() < 10) return false;
|
if (pos.getY() < 10) return false;
|
||||||
waterLevel = MHelper.min(pos.getY(), waterLevel);
|
waterLevel = MHelper.min(pos.getY(), waterLevel);
|
||||||
|
|
||||||
int minX = MHelper.floor((blockPos.getX() - dist - 16) >> 4) << 4;
|
|
||||||
int minZ = MHelper.floor((blockPos.getZ() - dist - 16) >> 4) << 4;
|
|
||||||
int maxX = MHelper.floor((blockPos.getX() + dist + 16) >> 4) << 4;
|
|
||||||
int maxZ = MHelper.floor((blockPos.getZ() + dist + 16) >> 4) << 4;
|
|
||||||
|
|
||||||
for (int y = blockPos.getY(); y <= blockPos.getY() + 10; y++) {
|
|
||||||
POS.setY(y);
|
|
||||||
for (int x = minX; x <= maxX; x++) {
|
|
||||||
POS.setX(x);
|
|
||||||
for (int z = minZ; z <= maxZ; z++) {
|
|
||||||
POS.setZ(z);
|
|
||||||
if (!world.getFluidState(POS).isEmpty())
|
|
||||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int y = blockPos.getY(); y <= blockPos.getY() + 10; y++) {
|
for (int y = blockPos.getY(); y <= blockPos.getY() + 10; y++) {
|
||||||
POS.setY(y);
|
POS.setY(y);
|
||||||
int add = y - blockPos.getY();
|
int add = y - blockPos.getY();
|
||||||
|
@ -74,10 +58,11 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
POS.setZ(z);
|
POS.setZ(z);
|
||||||
int z2 = z - blockPos.getZ();
|
int z2 = z - blockPos.getZ();
|
||||||
z2 *= z2;
|
z2 *= z2;
|
||||||
double r = add * 1.5 + radius * (NOISE.eval(x * 0.2, y * 0.2, z * 0.2) * 0.25 + 0.75);
|
double r = add * 1.8 + radius * (NOISE.eval(x * 0.2, y * 0.2, z * 0.2) * 0.25 + 0.75);
|
||||||
r *= r;
|
r *= r;
|
||||||
if (x2 + z2 <= r) {
|
if (x2 + z2 <= r) {
|
||||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
if (world.getBlockState(POS).getBlock() == Blocks.END_STONE)
|
||||||
|
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||||
pos = POS.down();
|
pos = POS.down();
|
||||||
if (world.getBlockState(pos).getBlock() == Blocks.END_STONE)
|
if (world.getBlockState(pos).getBlock() == Blocks.END_STONE)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +100,9 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
int z2 = z - blockPos.getZ();
|
int z2 = z - blockPos.getZ();
|
||||||
z2 *= z2;
|
z2 *= z2;
|
||||||
double r = radius * (NOISE.eval(x * 0.2, y * 0.2, z * 0.2) * 0.25 + 0.75);
|
double r = radius * (NOISE.eval(x * 0.2, y * 0.2, z * 0.2) * 0.25 + 0.75);
|
||||||
|
double rb = r * 1.2;
|
||||||
r *= r;
|
r *= r;
|
||||||
|
rb *= rb;
|
||||||
if (y2 + x2 + z2 <= r) {
|
if (y2 + x2 + z2 <= r) {
|
||||||
BlocksHelper.setWithoutUpdate(world, POS, y < waterLevel ? WATER : AIR);
|
BlocksHelper.setWithoutUpdate(world, POS, y < waterLevel ? WATER : AIR);
|
||||||
pos = POS.down();
|
pos = POS.down();
|
||||||
|
@ -124,11 +111,24 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
pos = POS.up();
|
pos = POS.up();
|
||||||
if (!world.getBlockState(pos).isAir()) {
|
if (!world.getBlockState(pos).isAir()) {
|
||||||
while (!world.getBlockState(pos).isAir()) {
|
while (!world.getBlockState(pos).isAir()) {
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, y < waterLevel ? WATER : AIR);
|
BlocksHelper.setWithoutUpdate(world, pos, pos.getY() < waterLevel ? WATER : AIR);
|
||||||
pos = pos.up();
|
pos = pos.up();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (y <= waterLevel && y2 + x2 + z2 <= rb) {
|
||||||
|
if (world.getBlockState(POS).getMaterial().isReplaceable()) {
|
||||||
|
if (world.isAir(POS.up())) {
|
||||||
|
BlockState state = world.getBiome(POS).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||||
|
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state : BlockRegistry.ENDSTONE_DUST.getDefaultState());
|
||||||
|
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.ENDSTONE_DUST.getDefaultState());
|
||||||
|
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,26 @@ import ru.betterend.world.biome.EndBiome;
|
||||||
|
|
||||||
public class BiomePicker {
|
public class BiomePicker {
|
||||||
private final List<EndBiome> biomes = Lists.newArrayList();
|
private final List<EndBiome> biomes = Lists.newArrayList();
|
||||||
|
private float maxChanceUnmutable = 0;
|
||||||
private float maxChance = 0;
|
private float maxChance = 0;
|
||||||
|
private int biomeCount = 0;
|
||||||
|
|
||||||
public void addBiome(EndBiome biome) {
|
public void addBiome(EndBiome biome) {
|
||||||
biomes.add(biome);
|
biomes.add(biome);
|
||||||
maxChance = biome.setGenChance(maxChance);
|
maxChance = biome.setGenChance(maxChance);
|
||||||
|
biomeCount ++;
|
||||||
|
maxChanceUnmutable = maxChance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBiomeMutable(EndBiome biome) {
|
||||||
|
biomes.add(biome);
|
||||||
|
maxChance = biome.setGenChance(maxChance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearMutables() {
|
||||||
|
maxChance = maxChanceUnmutable;
|
||||||
|
for (int i = biomes.size() - 1; i >= biomeCount; i--)
|
||||||
|
biomes.remove(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EndBiome getBiome(Random random) {
|
public EndBiome getBiome(Random random) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue