Fixed all remaining compile errors (mind the TODOs, a lot of things are disabled)
This commit is contained in:
parent
108d2bd710
commit
6c89c76c26
34 changed files with 241 additions and 430 deletions
|
@ -29,7 +29,6 @@ import ru.betterend.util.BonemealPlants;
|
||||||
import ru.betterend.util.LootTableUtil;
|
import ru.betterend.util.LootTableUtil;
|
||||||
import ru.betterend.world.generator.GeneratorOptions;
|
import ru.betterend.world.generator.GeneratorOptions;
|
||||||
import ru.betterend.world.generator.TerrainGenerator;
|
import ru.betterend.world.generator.TerrainGenerator;
|
||||||
import ru.betterend.world.surface.SurfaceBuilders;
|
|
||||||
|
|
||||||
public class BetterEnd implements ModInitializer {
|
public class BetterEnd implements ModInitializer {
|
||||||
public static final String MOD_ID = "betterend";
|
public static final String MOD_ID = "betterend";
|
||||||
|
@ -44,7 +43,6 @@ public class BetterEnd implements ModInitializer {
|
||||||
EndBlockEntities.register();
|
EndBlockEntities.register();
|
||||||
EndFeatures.register();
|
EndFeatures.register();
|
||||||
EndEntities.register();
|
EndEntities.register();
|
||||||
SurfaceBuilders.register();
|
|
||||||
EndBiomes.register();
|
EndBiomes.register();
|
||||||
EndTags.register();
|
EndTags.register();
|
||||||
EndEnchantments.register();
|
EndEnchantments.register();
|
||||||
|
|
|
@ -4,19 +4,13 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
|
||||||
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
public class DragonTreeSaplingBlock extends PottableFeatureSapling {
|
public class DragonTreeSaplingBlock extends PottableFeatureSapling {
|
||||||
public DragonTreeSaplingBlock() {
|
public DragonTreeSaplingBlock() {
|
||||||
super();
|
super((state)->EndFeatures.DRAGON_TREE.getFeature());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Feature<?> getFeature(BlockState state) {
|
|
||||||
return EndFeatures.DRAGON_TREE.getFeature();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,15 +4,13 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
|
||||||
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
public class HelixTreeSaplingBlock extends PottableFeatureSapling {
|
public class HelixTreeSaplingBlock extends PottableFeatureSapling {
|
||||||
@Override
|
public HelixTreeSaplingBlock() {
|
||||||
protected Feature<?> getFeature(BlockState state) {
|
super((state)->EndFeatures.HELIX_TREE.getFeature());
|
||||||
return EndFeatures.HELIX_TREE.getFeature();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,19 +4,13 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
|
||||||
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
public class LacugroveSaplingBlock extends PottableFeatureSapling {
|
public class LacugroveSaplingBlock extends PottableFeatureSapling {
|
||||||
public LacugroveSaplingBlock() {
|
public LacugroveSaplingBlock() {
|
||||||
super();
|
super((state)->EndFeatures.LACUGROVE.getFeature());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Feature<?> getFeature(BlockState state) {
|
|
||||||
return EndFeatures.LACUGROVE.getFeature();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,19 +4,13 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
|
||||||
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
public class LucerniaSaplingBlock extends PottableFeatureSapling {
|
public class LucerniaSaplingBlock extends PottableFeatureSapling {
|
||||||
public LucerniaSaplingBlock() {
|
public LucerniaSaplingBlock() {
|
||||||
super();
|
super((state)->EndFeatures.LUCERNIA.getFeature());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Feature<?> getFeature(BlockState state) {
|
|
||||||
return EndFeatures.LUCERNIA.getFeature();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,19 +4,13 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
|
||||||
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
import ru.betterend.blocks.basis.PottableFeatureSapling;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling {
|
public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling {
|
||||||
public MossyGlowshroomSaplingBlock() {
|
public MossyGlowshroomSaplingBlock() {
|
||||||
super(7);
|
super(7, (state)->EndFeatures.MOSSY_GLOWSHROOM.getFeature());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Feature<?> getFeature(BlockState state) {
|
|
||||||
return EndFeatures.MOSSY_GLOWSHROOM.getFeature();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
package ru.betterend.integration.rei;
|
package ru.betterend.integration.rei;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
|
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
|
||||||
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
|
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
|
||||||
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
|
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
|
||||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||||
import me.shedaniel.rei.api.common.entry.EntryIngredient;
|
|
||||||
import me.shedaniel.rei.api.common.entry.EntryStack;
|
import me.shedaniel.rei.api.common.entry.EntryStack;
|
||||||
import me.shedaniel.rei.api.common.util.EntryIngredients;
|
import me.shedaniel.rei.api.common.util.EntryIngredients;
|
||||||
import me.shedaniel.rei.api.common.util.EntryStacks;
|
import me.shedaniel.rei.api.common.util.EntryStacks;
|
||||||
import me.shedaniel.rei.plugin.common.DefaultPlugin;
|
import me.shedaniel.rei.plugin.common.DefaultPlugin;
|
||||||
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.BlastingRecipe;
|
import net.minecraft.world.item.crafting.BlastingRecipe;
|
||||||
|
@ -24,10 +26,6 @@ import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||||
import ru.betterend.recipe.builders.InfusionRecipe;
|
import ru.betterend.recipe.builders.InfusionRecipe;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
//https://github.com/shedaniel/RoughlyEnoughItems/blob/6.x-1.17/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
|
//https://github.com/shedaniel/RoughlyEnoughItems/blob/6.x-1.17/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
|
||||||
public class REIPlugin implements REIClientPlugin {
|
public class REIPlugin implements REIClientPlugin {
|
||||||
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");
|
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");
|
||||||
|
@ -55,12 +53,13 @@ public class REIPlugin implements REIClientPlugin {
|
||||||
registry.registerRecipeFiller(AnvilRecipe.class, AnvilRecipe.TYPE, REIAnvilDisplay::new);
|
registry.registerRecipeFiller(AnvilRecipe.class, AnvilRecipe.TYPE, REIAnvilDisplay::new);
|
||||||
registry.registerRecipeFiller(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new);
|
registry.registerRecipeFiller(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new);
|
||||||
|
|
||||||
FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
|
//TODO: 1.18 REI fix this
|
||||||
if (time >= 2000) {
|
// FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
|
||||||
final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
|
// if (time >= 2000) {
|
||||||
registry.add(new REIAlloyingFuelDisplay(list, time));
|
// final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
|
||||||
}
|
// registry.add(new REIAlloyingFuelDisplay(list, time));
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -429,8 +429,8 @@ public class EndBlocks {
|
||||||
public static final Block SILK_MOTH_HIVE = registerBlock("silk_moth_hive", new SilkMothHiveBlock());
|
public static final Block SILK_MOTH_HIVE = registerBlock("silk_moth_hive", new SilkMothHiveBlock());
|
||||||
|
|
||||||
// Ores //
|
// Ores //
|
||||||
public static final Block ENDER_ORE = registerBlock("ender_ore", new BaseOreBlock(EndItems.ENDER_SHARD, 1, 3, 5));
|
public static final Block ENDER_ORE = registerBlock("ender_ore", new BaseOreBlock(()->EndItems.ENDER_SHARD, 1, 3, 5));
|
||||||
public static final Block AMBER_ORE = registerBlock("amber_ore", new BaseOreBlock(EndItems.RAW_AMBER, 1, 2, 4));
|
public static final Block AMBER_ORE = registerBlock("amber_ore", new BaseOreBlock(()->EndItems.RAW_AMBER, 1, 2, 4));
|
||||||
|
|
||||||
// Materials //
|
// Materials //
|
||||||
public static final MetalMaterial THALLASIUM = MetalMaterial.makeNormal(
|
public static final MetalMaterial THALLASIUM = MetalMaterial.makeNormal(
|
||||||
|
|
|
@ -80,7 +80,6 @@ import ru.betterend.world.features.trees.MossyGlowshroomFeature;
|
||||||
import ru.betterend.world.features.trees.PythadendronTreeFeature;
|
import ru.betterend.world.features.trees.PythadendronTreeFeature;
|
||||||
import ru.betterend.world.features.trees.TenaneaFeature;
|
import ru.betterend.world.features.trees.TenaneaFeature;
|
||||||
import ru.betterend.world.features.trees.UmbrellaTreeFeature;
|
import ru.betterend.world.features.trees.UmbrellaTreeFeature;
|
||||||
import ru.betterend.world.surface.UmbraSurfaceBuilder;
|
|
||||||
|
|
||||||
public class EndFeatures {
|
public class EndFeatures {
|
||||||
// Trees //
|
// Trees //
|
||||||
|
@ -218,7 +217,8 @@ public class EndFeatures {
|
||||||
"umbralith_arch",
|
"umbralith_arch",
|
||||||
new ArchFeature(
|
new ArchFeature(
|
||||||
EndBlocks.UMBRALITH.stone,
|
EndBlocks.UMBRALITH.stone,
|
||||||
UmbraSurfaceBuilder::getSurfaceState
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
|
(pos)->Blocks.END_STONE.defaultBlockState() //UmbraSurfaceBuilder::getSurfaceState
|
||||||
),
|
),
|
||||||
10);
|
10);
|
||||||
public static final BCLFeature THIN_UMBRALITH_ARCH = registerChanced("thin_umbralith_arch", new ThinArchFeature(EndBlocks.UMBRALITH.stone), 15);
|
public static final BCLFeature THIN_UMBRALITH_ARCH = registerChanced("thin_umbralith_arch", new ThinArchFeature(EndBlocks.UMBRALITH.stone), 15);
|
||||||
|
|
|
@ -6,16 +6,23 @@ import net.minecraft.data.worldgen.StructureFeatures;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||||
import ru.bclib.interfaces.StructureFeaturesAccessor;
|
import ru.bclib.interfaces.StructureFeaturesAccessor;
|
||||||
import ru.bclib.world.biomes.BCLBiome;
|
import ru.bclib.world.biomes.BCLBiome;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
import ru.betterend.registry.EndSounds;
|
import ru.betterend.registry.EndSounds;
|
||||||
|
|
||||||
public class EndBiome extends BCLBiome {
|
public class EndBiome extends BCLBiome {
|
||||||
public abstract static class Config {
|
public abstract static class Config {
|
||||||
protected static final StructureFeaturesAccessor VANILLA_FEATURES = (StructureFeaturesAccessor)new StructureFeatures();
|
protected static final StructureFeaturesAccessor VANILLA_FEATURES = (StructureFeaturesAccessor)new StructureFeatures();
|
||||||
|
protected static final SurfaceRules.RuleSource END_STONE = SurfaceRules.state(Blocks.END_STONE.defaultBlockState());
|
||||||
|
protected static final SurfaceRules.RuleSource END_MOSS = SurfaceRules.state(EndBlocks.END_MOSS.defaultBlockState());
|
||||||
|
protected static final SurfaceRules.RuleSource ENDSTONE_DUST = SurfaceRules.state(EndBlocks.ENDSTONE_DUST.defaultBlockState());
|
||||||
|
protected static final SurfaceRules.RuleSource END_MYCELIUM = SurfaceRules.state(EndBlocks.END_MYCELIUM.defaultBlockState());
|
||||||
|
|
||||||
public final ResourceLocation ID;
|
public final ResourceLocation ID;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ public class FoggyMushroomlandBiome extends EndBiome.Config {
|
||||||
.fogColor(41, 122, 173)
|
.fogColor(41, 122, 173)
|
||||||
.fogDensity(3)
|
.fogDensity(3)
|
||||||
.waterAndFogColor(119, 227, 250)
|
.waterAndFogColor(119, 227, 250)
|
||||||
//TODO: 1.18 surface Rules
|
//TODO: 1.18 check surface Rules
|
||||||
|
.chancedSurface(END_MOSS, END_MYCELIUM, END_STONE)
|
||||||
//.surface(EndBlocks.END_MOSS, EndBlocks.END_MYCELIUM)
|
//.surface(EndBlocks.END_MOSS, EndBlocks.END_MYCELIUM)
|
||||||
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
|
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
|
||||||
.loop(EndSounds.AMBIENT_FOGGY_MUSHROOMLAND)
|
.loop(EndSounds.AMBIENT_FOGGY_MUSHROOMLAND)
|
||||||
|
|
|
@ -22,7 +22,8 @@ public class MegalakeBiome extends EndBiome.Config {
|
||||||
.fogDensity(1.75F)
|
.fogDensity(1.75F)
|
||||||
.music(EndSounds.MUSIC_WATER)
|
.music(EndSounds.MUSIC_WATER)
|
||||||
.loop(EndSounds.AMBIENT_MEGALAKE)
|
.loop(EndSounds.AMBIENT_MEGALAKE)
|
||||||
//TODO: 1.18 surface Rules
|
//TODO: 1.18 check surface Rules
|
||||||
|
.chancedSurface(END_MOSS, ENDSTONE_DUST, END_STONE)
|
||||||
//.surface(EndBlocks.END_MOSS, EndBlocks.ENDSTONE_DUST)
|
//.surface(EndBlocks.END_MOSS, EndBlocks.ENDSTONE_DUST)
|
||||||
//TODO: 1.18 removed
|
//TODO: 1.18 removed
|
||||||
//.depth(0F)
|
//.depth(0F)
|
||||||
|
|
|
@ -18,7 +18,8 @@ public class NeonOasisBiome extends EndBiome.Config {
|
||||||
.fogColor(226, 239, 168)
|
.fogColor(226, 239, 168)
|
||||||
.fogDensity(2)
|
.fogDensity(2)
|
||||||
.waterAndFogColor(106, 238, 215)
|
.waterAndFogColor(106, 238, 215)
|
||||||
//TODO: 1.18 surface Rules
|
//TODO: 1.18 check surface Rules
|
||||||
|
.chancedSurface(ENDSTONE_DUST, END_MOSS, END_STONE)
|
||||||
//.surface(EndBlocks.ENDSTONE_DUST, EndBlocks.END_MOSS)
|
//.surface(EndBlocks.ENDSTONE_DUST, EndBlocks.END_MOSS)
|
||||||
.particles(ParticleTypes.WHITE_ASH, 0.01F)
|
.particles(ParticleTypes.WHITE_ASH, 0.01F)
|
||||||
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)
|
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -17,8 +19,6 @@ import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.util.BlockFixer;
|
import ru.betterend.util.BlockFixer;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class DesertLakeFeature extends DefaultFeature {
|
public class DesertLakeFeature extends DefaultFeature {
|
||||||
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
||||||
|
@ -123,10 +123,8 @@ public class DesertLakeFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
pos = POS.below();
|
pos = POS.below();
|
||||||
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
|
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
|
||||||
state = world.getBiome(pos)
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
.getSurfaceBuilderConfig()
|
|
||||||
.getTopMaterial();
|
|
||||||
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
|
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
|
||||||
else if (y > waterLevel)
|
else if (y > waterLevel)
|
||||||
BlocksHelper.setWithoutUpdate(
|
BlocksHelper.setWithoutUpdate(
|
||||||
|
@ -198,10 +196,8 @@ public class DesertLakeFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
else if (y < waterLevel) {
|
else if (y < waterLevel) {
|
||||||
if (world.isEmptyBlock(POS.above())) {
|
if (world.isEmptyBlock(POS.above())) {
|
||||||
state = world.getBiome(POS)
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
.getSurfaceBuilderConfig()
|
|
||||||
.getTopMaterial();
|
|
||||||
BlocksHelper.setWithoutUpdate(
|
BlocksHelper.setWithoutUpdate(
|
||||||
world,
|
world,
|
||||||
POS,
|
POS,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -17,8 +19,6 @@ import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.util.BlockFixer;
|
import ru.betterend.util.BlockFixer;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class EndLakeFeature extends DefaultFeature {
|
public class EndLakeFeature extends DefaultFeature {
|
||||||
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
||||||
|
@ -123,10 +123,12 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
pos = POS.below();
|
pos = POS.below();
|
||||||
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
|
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
|
||||||
state = world.getBiome(pos)
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
state = Blocks.END_STONE.defaultBlockState();
|
||||||
.getSurfaceBuilderConfig()
|
// state = world.getBiome(pos)
|
||||||
.getTopMaterial();
|
// .getGenerationSettings()
|
||||||
|
// .getSurfaceBuilderConfig()
|
||||||
|
// .getTopMaterial();
|
||||||
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
|
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
|
||||||
else if (y > waterLevel)
|
else if (y > waterLevel)
|
||||||
BlocksHelper.setWithoutUpdate(
|
BlocksHelper.setWithoutUpdate(
|
||||||
|
@ -193,10 +195,12 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
// Make border
|
// Make border
|
||||||
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
|
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
|
||||||
if (world.isEmptyBlock(POS.above())) {
|
if (world.isEmptyBlock(POS.above())) {
|
||||||
state = world.getBiome(POS)
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
state = Blocks.END_STONE.defaultBlockState();
|
||||||
.getSurfaceBuilderConfig()
|
// state = world.getBiome(POS)
|
||||||
.getTopMaterial();
|
// .getGenerationSettings()
|
||||||
|
// .getSurfaceBuilderConfig()
|
||||||
|
// .getTopMaterial();
|
||||||
BlocksHelper.setWithoutUpdate(
|
BlocksHelper.setWithoutUpdate(
|
||||||
world,
|
world,
|
||||||
POS,
|
POS,
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -17,9 +22,6 @@ import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBiomes;
|
import ru.betterend.registry.EndBiomes;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class FloatingSpireFeature extends SpireFeature {
|
public class FloatingSpireFeature extends SpireFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
|
@ -62,13 +64,16 @@ public class FloatingSpireFeature extends SpireFeature {
|
||||||
if (random.nextInt(16) == 0) {
|
if (random.nextInt(16) == 0) {
|
||||||
support.add(info.getPos().above());
|
support.add(info.getPos().above());
|
||||||
}
|
}
|
||||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
|
return Blocks.END_STONE.defaultBlockState();//world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
}
|
}
|
||||||
else if (info.getState(Direction.UP, 3).isAir()) {
|
else if (info.getState(Direction.UP, 3).isAir()) {
|
||||||
return world.getBiome(info.getPos())
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
return Blocks.END_STONE.defaultBlockState();
|
||||||
.getSurfaceBuilderConfig()
|
// return world.getBiome(info.getPos())
|
||||||
.getUnderMaterial();
|
// .getGenerationSettings()
|
||||||
|
// .getSurfaceBuilderConfig()
|
||||||
|
// .getUnderMaterial();
|
||||||
}
|
}
|
||||||
return info.getState();
|
return info.getState();
|
||||||
});
|
});
|
||||||
|
@ -77,7 +82,7 @@ public class FloatingSpireFeature extends SpireFeature {
|
||||||
support.forEach((bpos) -> {
|
support.forEach((bpos) -> {
|
||||||
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||||
EndFeatures.TENANEA_BUSH.getFeature()
|
EndFeatures.TENANEA_BUSH.getFeature()
|
||||||
.place(new FeaturePlaceContext<>(world, chunkGenerator, random, bpos, null));
|
.place(new FeaturePlaceContext<>(Optional.empty(), world, chunkGenerator, random, bpos, null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
|
@ -37,9 +41,6 @@ import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
import ru.betterend.util.BlockFixer;
|
import ru.betterend.util.BlockFixer;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class GeyserFeature extends DefaultFeature {
|
public class GeyserFeature extends DefaultFeature {
|
||||||
protected static final Function<BlockState, Boolean> REPLACE1;
|
protected static final Function<BlockState, Boolean> REPLACE1;
|
||||||
protected static final Function<BlockState, Boolean> REPLACE2;
|
protected static final Function<BlockState, Boolean> REPLACE2;
|
||||||
|
@ -259,7 +260,7 @@ public class GeyserFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
EndFeatures.SULPHURIC_LAKE.getFeature()
|
EndFeatures.SULPHURIC_LAKE.getFeature()
|
||||||
.place(new FeaturePlaceContext<>(world, chunkGenerator, random, pos, null));
|
.place(new FeaturePlaceContext<>(Optional.empty(), world, chunkGenerator, random, pos, null));
|
||||||
|
|
||||||
double distance = radius1 * 1.7;
|
double distance = radius1 * 1.7;
|
||||||
BlockPos start = pos.offset(-distance, -halfHeight - 15 - distance, -distance);
|
BlockPos start = pos.offset(-distance, -halfHeight - 15 - distance, -distance);
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -11,8 +17,8 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.biomes.BiomeAPI;
|
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
import ru.bclib.api.biomes.BiomeAPI;
|
||||||
import ru.bclib.sdf.SDF;
|
import ru.bclib.sdf.SDF;
|
||||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||||
import ru.bclib.sdf.operator.SDFSmoothUnion;
|
import ru.bclib.sdf.operator.SDFSmoothUnion;
|
||||||
|
@ -24,10 +30,6 @@ import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBiomes;
|
import ru.betterend.registry.EndBiomes;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class SpireFeature extends DefaultFeature {
|
public class SpireFeature extends DefaultFeature {
|
||||||
protected static final Function<BlockState, Boolean> REPLACE;
|
protected static final Function<BlockState, Boolean> REPLACE;
|
||||||
|
|
||||||
|
@ -65,13 +67,17 @@ public class SpireFeature extends DefaultFeature {
|
||||||
if (random.nextInt(16) == 0) {
|
if (random.nextInt(16) == 0) {
|
||||||
support.add(info.getPos().above());
|
support.add(info.getPos().above());
|
||||||
}
|
}
|
||||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
|
return Blocks.END_STONE.defaultBlockState();
|
||||||
|
//return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
}
|
}
|
||||||
else if (info.getState(Direction.UP, 3).isAir()) {
|
else if (info.getState(Direction.UP, 3).isAir()) {
|
||||||
return world.getBiome(info.getPos())
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
return Blocks.END_STONE.defaultBlockState();
|
||||||
.getSurfaceBuilderConfig()
|
// return world.getBiome(info.getPos())
|
||||||
.getUnderMaterial();
|
// .getGenerationSettings()
|
||||||
|
// .getSurfaceBuilderConfig()
|
||||||
|
// .getUnderMaterial();
|
||||||
}
|
}
|
||||||
return info.getState();
|
return info.getState();
|
||||||
}).fillRecursive(world, center);
|
}).fillRecursive(world, center);
|
||||||
|
@ -79,7 +85,7 @@ public class SpireFeature extends DefaultFeature {
|
||||||
support.forEach((bpos) -> {
|
support.forEach((bpos) -> {
|
||||||
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||||
EndFeatures.TENANEA_BUSH.getFeature()
|
EndFeatures.TENANEA_BUSH.getFeature()
|
||||||
.place(new FeaturePlaceContext<>(world, chunkGenerator, random, bpos, null));
|
.place(new FeaturePlaceContext<>(Optional.empty(), world, chunkGenerator, random, bpos, null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -22,9 +26,6 @@ import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.util.BlockFixer;
|
import ru.betterend.util.BlockFixer;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class SulphuricCaveFeature extends DefaultFeature {
|
public class SulphuricCaveFeature extends DefaultFeature {
|
||||||
private static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
private static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
||||||
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||||
|
@ -167,7 +168,8 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
||||||
state = world.getBlockState(mut);
|
state = world.getBlockState(mut);
|
||||||
while (state.is(Blocks.WATER)) {
|
while (state.is(Blocks.WATER)) {
|
||||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.VENT_BUBBLE_COLUMN.defaultBlockState());
|
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.VENT_BUBBLE_COLUMN.defaultBlockState());
|
||||||
world.getBlockTicks()
|
//TODO: 1.18 test ticks
|
||||||
|
world/*.getBlockTicks()*/
|
||||||
.scheduleTick(mut, EndBlocks.VENT_BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
|
.scheduleTick(mut, EndBlocks.VENT_BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
|
||||||
mut.setY(mut.getY() + 1);
|
mut.setY(mut.getY() + 1);
|
||||||
state = world.getBlockState(mut);
|
state = world.getBlockState(mut);
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -19,9 +23,6 @@ import ru.betterend.blocks.SulphurCrystalBlock;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class SulphuricLakeFeature extends DefaultFeature {
|
public class SulphuricLakeFeature extends DefaultFeature {
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
||||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||||
|
@ -75,7 +76,8 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
||||||
else {
|
else {
|
||||||
if (!isAbsoluteBorder(world, POS)) {
|
if (!isAbsoluteBorder(world, POS)) {
|
||||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.WATER);
|
BlocksHelper.setWithoutUpdate(world, POS, Blocks.WATER);
|
||||||
world.getLiquidTicks().scheduleTick(POS, Fluids.WATER, 0);
|
//TODO: 1.18 check if this ticks
|
||||||
|
world./*getLiquidTicks().*/scheduleTick(POS, Fluids.WATER, 0);
|
||||||
brimstone.add(POS.below());
|
brimstone.add(POS.below());
|
||||||
if (random.nextBoolean()) {
|
if (random.nextBoolean()) {
|
||||||
brimstone.add(POS.below(2));
|
brimstone.add(POS.below(2));
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
package ru.betterend.world.features.terrain.caves;
|
package ru.betterend.world.features.terrain.caves;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -16,10 +22,6 @@ import ru.bclib.world.features.DefaultFeature;
|
||||||
import ru.betterend.util.BlockFixer;
|
import ru.betterend.util.BlockFixer;
|
||||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
public class CaveChunkPopulatorFeature extends DefaultFeature {
|
public class CaveChunkPopulatorFeature extends DefaultFeature {
|
||||||
private Supplier<EndCaveBiome> supplier;
|
private Supplier<EndCaveBiome> supplier;
|
||||||
|
|
||||||
|
@ -40,7 +42,8 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
||||||
MutableBlockPos max = new MutableBlockPos().set(pos);
|
MutableBlockPos max = new MutableBlockPos().set(pos);
|
||||||
fillSets(sx, sz, world.getChunk(pos), floorPositions, ceilPositions, min, max);
|
fillSets(sx, sz, world.getChunk(pos), floorPositions, ceilPositions, min, max);
|
||||||
EndCaveBiome biome = supplier.get();
|
EndCaveBiome biome = supplier.get();
|
||||||
BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
//TODO: 1.18 This needs to change to a configured material
|
||||||
|
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState(); //biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
||||||
placeCeil(world, biome, ceilPositions, random);
|
placeCeil(world, biome, ceilPositions, random);
|
||||||
BlockFixer.fixBlocks(world, min, max);
|
BlockFixer.fixBlocks(world, min, max);
|
||||||
|
@ -111,7 +114,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
Feature<?> feature = biome.getFloorFeature(random);
|
Feature<?> feature = biome.getFloorFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null) {
|
||||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -127,7 +130,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
Feature<?> feature = biome.getCeilFeature(random);
|
Feature<?> feature = biome.getCeilFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null) {
|
||||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
package ru.betterend.world.features.terrain.caves;
|
package ru.betterend.world.features.terrain.caves;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -14,9 +20,8 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.api.biomes.BiomeAPI;
|
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.interfaces.BiomeSetter;
|
import ru.bclib.api.biomes.BiomeAPI;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.bclib.world.biomes.BCLBiome;
|
import ru.bclib.world.biomes.BCLBiome;
|
||||||
|
@ -25,10 +30,6 @@ import ru.betterend.registry.EndBiomes;
|
||||||
import ru.betterend.util.BlockFixer;
|
import ru.betterend.util.BlockFixer;
|
||||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public abstract class EndCaveFeature extends DefaultFeature {
|
public abstract class EndCaveFeature extends DefaultFeature {
|
||||||
protected static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
protected static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
||||||
protected static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
protected static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
||||||
|
@ -74,10 +75,9 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
BlockState surfaceBlock = biome.getBiome()
|
|
||||||
.getGenerationSettings()
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getSurfaceBuilderConfig()
|
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState(); //biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
.getTopMaterial();
|
|
||||||
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
||||||
placeCeil(world, biome, ceilPositions, random);
|
placeCeil(world, biome, ceilPositions, random);
|
||||||
placeWalls(world, biome, caveBlocks, random);
|
placeWalls(world, biome, caveBlocks, random);
|
||||||
|
@ -99,7 +99,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
Feature<?> feature = biome.getFloorFeature(random);
|
Feature<?> feature = biome.getFloorFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null) {
|
||||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -115,7 +115,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
Feature<?> feature = biome.getCeilFeature(random);
|
Feature<?> feature = biome.getCeilFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null) {
|
||||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -155,10 +155,11 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) {
|
protected void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) {
|
||||||
BiomeSetter array = (BiomeSetter) world.getChunk(pos).getBiomes();
|
//TODO: 1.18 No longer implemented in BCLib
|
||||||
if (array != null) {
|
// BiomeSetter array = (BiomeSetter) world.getChunk(pos).getBiomes();
|
||||||
array.bclib_setBiome(biome.getActualBiome(), pos);
|
// if (array != null) {
|
||||||
}
|
// array.bclib_setBiome(biome.getActualBiome(), pos);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockPos findPos(WorldGenLevel world, BlockPos pos, int radius, Random random) {
|
private BlockPos findPos(WorldGenLevel world, BlockPos pos, int radius, Random random) {
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
package ru.betterend.world.features.terrain.caves;
|
package ru.betterend.world.features.terrain.caves;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -15,19 +22,14 @@ import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.api.biomes.BiomeAPI;
|
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
import ru.bclib.api.biomes.BiomeAPI;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.bclib.world.biomes.BCLBiome;
|
import ru.bclib.world.biomes.BCLBiome;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBiomes;
|
import ru.betterend.registry.EndBiomes;
|
||||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
public class TunelCaveFeature extends EndCaveFeature {
|
public class TunelCaveFeature extends EndCaveFeature {
|
||||||
private Set<BlockPos> generate(WorldGenLevel world, BlockPos center, Random random) {
|
private Set<BlockPos> generate(WorldGenLevel world, BlockPos center, Random random) {
|
||||||
int cx = center.getX() >> 4;
|
int cx = center.getX() >> 4;
|
||||||
|
@ -166,10 +168,12 @@ public class TunelCaveFeature extends EndCaveFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
floorSets.forEach((biome, floorPositions) -> {
|
floorSets.forEach((biome, floorPositions) -> {
|
||||||
BlockState surfaceBlock = biome.getBiome()
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState();
|
||||||
.getSurfaceBuilderConfig()
|
// BlockState surfaceBlock = biome.getBiome()
|
||||||
.getTopMaterial();
|
// .getGenerationSettings()
|
||||||
|
// .getSurfaceBuilderConfig()
|
||||||
|
// .getTopMaterial();
|
||||||
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
||||||
});
|
});
|
||||||
ceilSets.forEach((biome, ceilPositions) -> {
|
ceilSets.forEach((biome, ceilPositions) -> {
|
||||||
|
@ -197,7 +201,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
Feature<?> feature = biome.getFloorFeature(random);
|
Feature<?> feature = biome.getFloorFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null) {
|
||||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -214,7 +218,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
Feature<?> feature = biome.getCeilFeature(random);
|
Feature<?> feature = biome.getCeilFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null) {
|
||||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package ru.betterend.world.generator;
|
package ru.betterend.world.generator;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
|
||||||
import net.minecraft.world.level.biome.BiomeSource;
|
|
||||||
import ru.bclib.util.MHelper;
|
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
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.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.level.biome.BiomeSource;
|
||||||
|
import ru.bclib.util.MHelper;
|
||||||
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
|
|
||||||
public class TerrainGenerator {
|
public class TerrainGenerator {
|
||||||
private static final Map<Point, TerrainBoolCache> TERRAIN_BOOL_CACHE_MAP = Maps.newHashMap();
|
private static final Map<Point, TerrainBoolCache> TERRAIN_BOOL_CACHE_MAP = Maps.newHashMap();
|
||||||
private static final ReentrantLock LOCKER = new ReentrantLock();
|
private static final ReentrantLock LOCKER = new ReentrantLock();
|
||||||
|
@ -83,21 +83,23 @@ public class TerrainGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float getAverageDepth(BiomeSource biomeSource, int x, int z) {
|
private static float getAverageDepth(BiomeSource biomeSource, int x, int z) {
|
||||||
if (getBiome(biomeSource, x, z).getDepth() < 0.1F) {
|
//TODO: 1.18 find alternative
|
||||||
return 0F;
|
// if (getBiome(biomeSource, x, z).getDepth() < 0.1F) {
|
||||||
}
|
// return 0F;
|
||||||
float depth = 0F;
|
// }
|
||||||
for (int i = 0; i < OFFS.length; i++) {
|
// float depth = 0F;
|
||||||
int px = x + OFFS[i].x;
|
// for (int i = 0; i < OFFS.length; i++) {
|
||||||
int pz = z + OFFS[i].y;
|
// int px = x + OFFS[i].x;
|
||||||
depth += getBiome(biomeSource, px, pz).getDepth() * COEF[i];
|
// int pz = z + OFFS[i].y;
|
||||||
}
|
// depth += getBiome(biomeSource, px, pz).getDepth() * COEF[i];
|
||||||
return depth;
|
// }
|
||||||
|
// return depth;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Biome getBiome(BiomeSource biomeSource, int x, int z) {
|
// private static Biome getBiome(BiomeSource biomeSource, int x, int z) {
|
||||||
return biomeSource.getNoiseBiome(x, 0, z);
|
// return biomeSource.getNoiseBiome(x, 0, z);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if this is land
|
* Check if this is land
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
package ru.betterend.world.structures.piece;
|
package ru.betterend.world.structures.piece;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndStructures;
|
import ru.betterend.registry.EndStructures;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class CavePiece extends BasePiece {
|
public class CavePiece extends BasePiece {
|
||||||
private OpenSimplexNoise noise;
|
private OpenSimplexNoise noise;
|
||||||
private BlockPos center;
|
private BlockPos center;
|
||||||
|
@ -32,11 +32,12 @@ public class CavePiece extends BasePiece {
|
||||||
makeBoundingBox();
|
makeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CavePiece(ServerLevel serverLevel, CompoundTag tag) {
|
public CavePiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||||
super(EndStructures.CAVE_PIECE, tag);
|
super(EndStructures.CAVE_PIECE, tag);
|
||||||
makeBoundingBox();
|
makeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||||
int x1 = MHelper.max(this.boundingBox.minX(), blockBox.minX());
|
int x1 = MHelper.max(this.boundingBox.minX(), blockBox.minX());
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.world.structures.piece;
|
package ru.betterend.world.structures.piece;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -17,34 +19,32 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||||
import ru.bclib.api.biomes.BiomeAPI;
|
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndStructures;
|
import ru.betterend.registry.EndStructures;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class CrystalMountainPiece extends MountainPiece {
|
public class CrystalMountainPiece extends MountainPiece {
|
||||||
private BlockState top;
|
private BlockState top;
|
||||||
|
|
||||||
public CrystalMountainPiece(BlockPos center, float radius, float height, Random random, Biome biome) {
|
public CrystalMountainPiece(BlockPos center, float radius, float height, Random random, Biome biome) {
|
||||||
super(EndStructures.MOUNTAIN_PIECE, center, radius, height, random, biome);
|
super(EndStructures.MOUNTAIN_PIECE, center, radius, height, random, biome);
|
||||||
top = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
|
top = Blocks.END_STONE.defaultBlockState(); //biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrystalMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
|
public CrystalMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||||
super(EndStructures.MOUNTAIN_PIECE, serverLevel, tag);
|
super(EndStructures.MOUNTAIN_PIECE, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void fromNbt(CompoundTag tag) {
|
protected void fromNbt(CompoundTag tag) {
|
||||||
super.fromNbt(tag);
|
super.fromNbt(tag);//TODO: 1.18 this needs to change to a dynamic block
|
||||||
top = BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
top = Blocks.END_STONE.defaultBlockState(); //BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||||
int sx = chunkPos.getMinBlockX();
|
int sx = chunkPos.getMinBlockX();
|
||||||
int sz = chunkPos.getMinBlockZ();
|
int sz = chunkPos.getMinBlockZ();
|
||||||
MutableBlockPos pos = new MutableBlockPos();
|
MutableBlockPos pos = new MutableBlockPos();
|
||||||
|
@ -139,8 +139,6 @@ public class CrystalMountainPiece extends MountainPiece {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void crystal(ChunkAccess chunk, BlockPos pos, int radius, int height, float fill, Random random) {
|
private void crystal(ChunkAccess chunk, BlockPos pos, int radius, int height, float fill, Random random) {
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ru.betterend.world.structures.piece;
|
package ru.betterend.world.structures.piece;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -8,7 +12,6 @@ import net.minecraft.core.SectionPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
|
@ -20,18 +23,16 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import ru.bclib.api.biomes.BiomeAPI;
|
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
import ru.bclib.api.biomes.BiomeAPI;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndStructures;
|
import ru.betterend.registry.EndStructures;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class LakePiece extends BasePiece {
|
public class LakePiece extends BasePiece {
|
||||||
private static final BlockState ENDSTONE = Blocks.END_STONE.defaultBlockState();
|
private static final BlockState ENDSTONE = Blocks.END_STONE.defaultBlockState();
|
||||||
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||||
|
@ -57,7 +58,7 @@ public class LakePiece extends BasePiece {
|
||||||
makeBoundingBox();
|
makeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LakePiece(ServerLevel serverLevel, CompoundTag tag) {
|
public LakePiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||||
super(EndStructures.LAKE_PIECE, tag);
|
super(EndStructures.LAKE_PIECE, tag);
|
||||||
makeBoundingBox();
|
makeBoundingBox();
|
||||||
}
|
}
|
||||||
|
@ -131,10 +132,12 @@ public class LakePiece extends BasePiece {
|
||||||
)) {
|
)) {
|
||||||
state = chunk.getBlockState(mut.above());
|
state = chunk.getBlockState(mut.above());
|
||||||
if (state.isAir()) {
|
if (state.isAir()) {
|
||||||
state = random.nextBoolean() ? ENDSTONE : world.getBiome(worldPos)
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
state = ENDSTONE;
|
||||||
.getSurfaceBuilderConfig()
|
// state = random.nextBoolean() ? ENDSTONE : world.getBiome(worldPos)
|
||||||
.getTopMaterial();
|
// .getGenerationSettings()
|
||||||
|
// .getSurfaceBuilderConfig()
|
||||||
|
// .getTopMaterial();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state = state.getFluidState()
|
state = state.getFluidState()
|
||||||
|
@ -147,7 +150,6 @@ public class LakePiece extends BasePiece {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fixWater(world, chunk, mut, random, sx, sz);
|
fixWater(world, chunk, mut, random, sx, sz);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fixWater(WorldGenLevel world, ChunkAccess chunk, MutableBlockPos mut, Random random, int sx, int sz) {
|
private void fixWater(WorldGenLevel world, ChunkAccess chunk, MutableBlockPos mut, Random random, int sx, int sz) {
|
||||||
|
@ -167,10 +169,12 @@ public class LakePiece extends BasePiece {
|
||||||
|
|
||||||
BlockState bState = chunk.getBlockState(mut);
|
BlockState bState = chunk.getBlockState(mut);
|
||||||
if (bState.isAir()) {
|
if (bState.isAir()) {
|
||||||
bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
bState = ENDSTONE;
|
||||||
.getSurfaceBuilderConfig()
|
// bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
|
||||||
.getTopMaterial();
|
// .getGenerationSettings()
|
||||||
|
// .getSurfaceBuilderConfig()
|
||||||
|
// .getTopMaterial();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bState = bState.getFluidState()
|
bState = bState.getFluidState()
|
||||||
|
@ -189,10 +193,12 @@ public class LakePiece extends BasePiece {
|
||||||
mut.setY(y + 1);
|
mut.setY(y + 1);
|
||||||
BlockState bState = chunk.getBlockState(mut);
|
BlockState bState = chunk.getBlockState(mut);
|
||||||
if (bState.isAir()) {
|
if (bState.isAir()) {
|
||||||
bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
|
//TODO: 1.18 this needs to change to a dynamic block
|
||||||
.getGenerationSettings()
|
bState = ENDSTONE;
|
||||||
.getSurfaceBuilderConfig()
|
// bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
|
||||||
.getTopMaterial();
|
// .getGenerationSettings()
|
||||||
|
// .getSurfaceBuilderConfig()
|
||||||
|
// .getTopMaterial();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bState = bState.getFluidState()
|
bState = bState.getFluidState()
|
||||||
|
@ -205,7 +211,8 @@ public class LakePiece extends BasePiece {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (chunk.getBlockState(mut.move(Direction.UP)).isAir()) {
|
else if (chunk.getBlockState(mut.move(Direction.UP)).isAir()) {
|
||||||
chunk.getLiquidTicks().scheduleTick(mut.move(Direction.DOWN), state.getType(), 0);
|
//TODO: 1.18 test if this is thr right tick
|
||||||
|
/*chunk.getLiquidTicks()*/world.scheduleTick(mut.move(Direction.DOWN), state.getType(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package ru.betterend.world.structures.piece;
|
package ru.betterend.world.structures.piece;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
@ -17,9 +20,6 @@ import ru.bclib.api.biomes.BiomeAPI;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public abstract class MountainPiece extends BasePiece {
|
public abstract class MountainPiece extends BasePiece {
|
||||||
protected Map<Integer, Integer> heightmap = Maps.newHashMap();
|
protected Map<Integer, Integer> heightmap = Maps.newHashMap();
|
||||||
protected OpenSimplexNoise noise1;
|
protected OpenSimplexNoise noise1;
|
||||||
|
@ -46,7 +46,7 @@ public abstract class MountainPiece extends BasePiece {
|
||||||
makeBoundingBox();
|
makeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MountainPiece(StructurePieceType type, ServerLevel serverLevel, CompoundTag tag) {
|
public MountainPiece(StructurePieceType type, CompoundTag tag) {
|
||||||
super(type, tag);
|
super(type, tag);
|
||||||
makeBoundingBox();
|
makeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package ru.betterend.world.structures.piece;
|
package ru.betterend.world.structures.piece;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Vec3i;
|
import net.minecraft.core.Vec3i;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -13,14 +14,13 @@ import net.minecraft.world.level.block.Mirror;
|
||||||
import net.minecraft.world.level.block.Rotation;
|
import net.minecraft.world.level.block.Rotation;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.bclib.util.StructureHelper;
|
import ru.bclib.util.StructureHelper;
|
||||||
import ru.betterend.registry.EndStructures;
|
import ru.betterend.registry.EndStructures;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class NBTPiece extends BasePiece {
|
public class NBTPiece extends BasePiece {
|
||||||
private ResourceLocation structureID;
|
private ResourceLocation structureID;
|
||||||
private Rotation rotation;
|
private Rotation rotation;
|
||||||
|
@ -42,13 +42,14 @@ public class NBTPiece extends BasePiece {
|
||||||
makeBoundingBox();
|
makeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTPiece(ServerLevel serverLevel, CompoundTag tag) {
|
public NBTPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||||
super(EndStructures.NBT_PIECE, tag);
|
super(EndStructures.NBT_PIECE, tag);
|
||||||
makeBoundingBox();
|
makeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||||
|
super.addAdditionalSaveData(tag);
|
||||||
tag.putString("structureID", structureID.toString());
|
tag.putString("structureID", structureID.toString());
|
||||||
tag.putInt("rotation", rotation.ordinal());
|
tag.putInt("rotation", rotation.ordinal());
|
||||||
tag.putInt("mirror", mirror.ordinal());
|
tag.putInt("mirror", mirror.ordinal());
|
||||||
|
@ -69,7 +70,7 @@ public class NBTPiece extends BasePiece {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||||
BoundingBox bounds = BoundingBox.fromCorners(new Vec3i(
|
BoundingBox bounds = BoundingBox.fromCorners(new Vec3i(
|
||||||
blockBox.minX(),
|
blockBox.minX(),
|
||||||
this.boundingBox.minY(),
|
this.boundingBox.minY(),
|
||||||
|
@ -90,7 +91,6 @@ public class NBTPiece extends BasePiece {
|
||||||
if (cover) {
|
if (cover) {
|
||||||
StructureHelper.cover(world, bounds, random);
|
StructureHelper.cover(world, bounds, random);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeBoundingBox() {
|
private void makeBoundingBox() {
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package ru.betterend.world.structures.piece;
|
package ru.betterend.world.structures.piece;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -16,11 +17,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.registry.EndStructures;
|
import ru.betterend.registry.EndStructures;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class PaintedMountainPiece extends MountainPiece {
|
public class PaintedMountainPiece extends MountainPiece {
|
||||||
private BlockState[] slises;
|
private BlockState[] slises;
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@ public class PaintedMountainPiece extends MountainPiece {
|
||||||
this.slises = slises;
|
this.slises = slises;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaintedMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
|
public PaintedMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||||
super(EndStructures.PAINTED_MOUNTAIN_PIECE, serverLevel, tag);
|
super(EndStructures.PAINTED_MOUNTAIN_PIECE, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||||
super.addAdditionalSaveData(serverLevel, tag);
|
super.addAdditionalSaveData(tag);
|
||||||
ListTag slise = new ListTag();
|
ListTag slise = new ListTag();
|
||||||
for (BlockState state : slises) {
|
for (BlockState state : slises) {
|
||||||
slise.add(NbtUtils.writeBlockState(state));
|
slise.add(NbtUtils.writeBlockState(state));
|
||||||
|
@ -54,7 +54,7 @@ public class PaintedMountainPiece extends MountainPiece {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||||
int sx = chunkPos.getMinBlockX();
|
int sx = chunkPos.getMinBlockX();
|
||||||
int sz = chunkPos.getMinBlockZ();
|
int sz = chunkPos.getMinBlockZ();
|
||||||
MutableBlockPos pos = new MutableBlockPos();
|
MutableBlockPos pos = new MutableBlockPos();
|
||||||
|
@ -101,7 +101,5 @@ public class PaintedMountainPiece extends MountainPiece {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package ru.betterend.world.structures.piece;
|
package ru.betterend.world.structures.piece;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||||
import ru.bclib.world.structures.StructureWorld;
|
import ru.bclib.world.structures.StructureWorld;
|
||||||
import ru.betterend.registry.EndStructures;
|
import ru.betterend.registry.EndStructures;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class VoxelPiece extends BasePiece {
|
public class VoxelPiece extends BasePiece {
|
||||||
private StructureWorld world;
|
private StructureWorld world;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class VoxelPiece extends BasePiece {
|
||||||
this.boundingBox = world.getBounds();
|
this.boundingBox = world.getBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
public VoxelPiece(ServerLevel level, CompoundTag tag) {
|
public VoxelPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||||
super(EndStructures.VOXEL_PIECE, tag);
|
super(EndStructures.VOXEL_PIECE, tag);
|
||||||
this.boundingBox = world.getBounds();
|
this.boundingBox = world.getBounds();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,100 +0,0 @@
|
||||||
package ru.betterend.world.surface;
|
|
||||||
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
|
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
|
||||||
import ru.bclib.util.MHelper;
|
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class SulphuricSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBaseConfiguration> {
|
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(5123);
|
|
||||||
|
|
||||||
public SulphuricSurfaceBuilder() {
|
|
||||||
super(SurfaceBuilderBaseConfiguration.CODEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(Random random, ChunkAccess chunk, Biome biome, int x, int z, int height, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, int seed, long n, SurfaceBuilderBaseConfiguration surfaceBlocks) {
|
|
||||||
double value = NOISE.eval(x * 0.03, z * 0.03) + NOISE.eval(x * 0.1, z * 0.1) * 0.3 + MHelper.randRange(
|
|
||||||
-0.1,
|
|
||||||
0.1,
|
|
||||||
MHelper.RANDOM
|
|
||||||
);
|
|
||||||
if (value < -0.6) {
|
|
||||||
SurfaceBuilder.DEFAULT.apply(
|
|
||||||
random,
|
|
||||||
chunk,
|
|
||||||
biome,
|
|
||||||
x,
|
|
||||||
z,
|
|
||||||
height,
|
|
||||||
noise,
|
|
||||||
defaultBlock,
|
|
||||||
defaultFluid,
|
|
||||||
seaLevel,
|
|
||||||
seed,
|
|
||||||
n,
|
|
||||||
SurfaceBuilders.DEFAULT_END_CONFIG
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (value < -0.3) {
|
|
||||||
SurfaceBuilder.DEFAULT.apply(
|
|
||||||
random,
|
|
||||||
chunk,
|
|
||||||
biome,
|
|
||||||
x,
|
|
||||||
z,
|
|
||||||
height,
|
|
||||||
noise,
|
|
||||||
defaultBlock,
|
|
||||||
defaultFluid,
|
|
||||||
seaLevel,
|
|
||||||
seed,
|
|
||||||
n,
|
|
||||||
SurfaceBuilders.FLAVOLITE_CONFIG
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (value < 0.5) {
|
|
||||||
SurfaceBuilder.DEFAULT.apply(
|
|
||||||
random,
|
|
||||||
chunk,
|
|
||||||
biome,
|
|
||||||
x,
|
|
||||||
z,
|
|
||||||
height,
|
|
||||||
noise,
|
|
||||||
defaultBlock,
|
|
||||||
defaultFluid,
|
|
||||||
seaLevel,
|
|
||||||
seed,
|
|
||||||
n,
|
|
||||||
SurfaceBuilders.SULFURIC_ROCK_CONFIG
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SurfaceBuilder.DEFAULT.apply(
|
|
||||||
random,
|
|
||||||
chunk,
|
|
||||||
biome,
|
|
||||||
x,
|
|
||||||
z,
|
|
||||||
height,
|
|
||||||
noise,
|
|
||||||
defaultBlock,
|
|
||||||
defaultFluid,
|
|
||||||
seaLevel,
|
|
||||||
seed,
|
|
||||||
n,
|
|
||||||
SurfaceBuilders.BRIMSTONE_CONFIG
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*public static SulphuricSurfaceBuilder register(String name) {
|
|
||||||
return Registry.register(Registry.SURFACE_BUILDER, name, new SulphuricSurfaceBuilder());
|
|
||||||
}*/
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
package ru.betterend.world.surface;
|
|
||||||
|
|
||||||
import net.minecraft.core.Registry;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.Blocks;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
|
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
|
||||||
import ru.betterend.registry.EndBlocks;
|
|
||||||
|
|
||||||
public class SurfaceBuilders {
|
|
||||||
public static final SurfaceBuilderBaseConfiguration DEFAULT_END_CONFIG = makeSimpleConfig(Blocks.END_STONE);
|
|
||||||
public static final SurfaceBuilderBaseConfiguration FLAVOLITE_CONFIG = makeSimpleConfig(EndBlocks.FLAVOLITE.stone);
|
|
||||||
public static final SurfaceBuilderBaseConfiguration BRIMSTONE_CONFIG = makeSimpleConfig(EndBlocks.BRIMSTONE);
|
|
||||||
public static final SurfaceBuilderBaseConfiguration SULFURIC_ROCK_CONFIG = makeSimpleConfig(EndBlocks.SULPHURIC_ROCK.stone);
|
|
||||||
public static final SurfaceBuilderBaseConfiguration UMBRA_SURFACE_CONFIG = makeSimpleConfig(EndBlocks.UMBRALITH.stone);
|
|
||||||
public static final SurfaceBuilderBaseConfiguration PALLIDIUM_FULL_SURFACE_CONFIG = makeSurfaceConfig(EndBlocks.PALLIDIUM_FULL, EndBlocks.UMBRALITH.stone);
|
|
||||||
public static final SurfaceBuilderBaseConfiguration PALLIDIUM_HEAVY_SURFACE_CONFIG = makeSurfaceConfig(EndBlocks.PALLIDIUM_HEAVY, EndBlocks.UMBRALITH.stone);
|
|
||||||
public static final SurfaceBuilderBaseConfiguration PALLIDIUM_THIN_SURFACE_CONFIG = makeSurfaceConfig(EndBlocks.PALLIDIUM_THIN, EndBlocks.UMBRALITH.stone);
|
|
||||||
public static final SurfaceBuilderBaseConfiguration PALLIDIUM_TINY_SURFACE_CONFIG = makeSurfaceConfig(EndBlocks.PALLIDIUM_TINY, EndBlocks.UMBRALITH.stone);
|
|
||||||
|
|
||||||
public static final SurfaceBuilder<SurfaceBuilderBaseConfiguration> SULPHURIC_SURFACE = register(
|
|
||||||
"sulphuric_surface",
|
|
||||||
new SulphuricSurfaceBuilder()
|
|
||||||
);
|
|
||||||
public static final SurfaceBuilder<SurfaceBuilderBaseConfiguration> UMBRA_SURFACE = register(
|
|
||||||
"umbra_surface",
|
|
||||||
new UmbraSurfaceBuilder()
|
|
||||||
);
|
|
||||||
|
|
||||||
private static SurfaceBuilder<SurfaceBuilderBaseConfiguration> register(String name, SurfaceBuilder<SurfaceBuilderBaseConfiguration> builder) {
|
|
||||||
return Registry.register(Registry.SURFACE_BUILDER, name, builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SurfaceBuilderBaseConfiguration makeSimpleConfig(Block block) {
|
|
||||||
BlockState state = block.defaultBlockState();
|
|
||||||
return new SurfaceBuilderBaseConfiguration(state, state, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SurfaceBuilderBaseConfiguration makeSurfaceConfig(Block surface, Block under) {
|
|
||||||
return new SurfaceBuilderBaseConfiguration(
|
|
||||||
surface.defaultBlockState(),
|
|
||||||
under.defaultBlockState(),
|
|
||||||
under.defaultBlockState()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void register() {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
package ru.betterend.world.surface;
|
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
|
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
|
||||||
import ru.bclib.util.MHelper;
|
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class UmbraSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBaseConfiguration> {
|
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(1512);
|
|
||||||
|
|
||||||
public UmbraSurfaceBuilder() {
|
|
||||||
super(SurfaceBuilderBaseConfiguration.CODEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(Random random, ChunkAccess chunk, Biome biome, int x, int z, int height, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, int seed, long n, SurfaceBuilderBaseConfiguration surfaceBlocks) {
|
|
||||||
int depth = (int) (NOISE.eval(x * 0.1, z * 0.1) * 20 + NOISE.eval(x * 0.5, z * 0.5) * 10 + 60);
|
|
||||||
SurfaceBuilderBaseConfiguration config = getConfig(x, z, random);
|
|
||||||
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise + depth, defaultBlock, defaultFluid, seaLevel, seed, n, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockState getSurfaceState(BlockPos pos) {
|
|
||||||
return getConfig(pos.getX(), pos.getZ(), MHelper.RANDOM).getTopMaterial();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SurfaceBuilderBaseConfiguration getConfig(int x, int z, Random random) {
|
|
||||||
float grass = ((float) NOISE.eval(x * 0.03, z * 0.03) + (float) NOISE.eval(x * 0.1, z * 0.1) * 0.6F + random.nextFloat() * 0.2F) - 0.05F;
|
|
||||||
if (grass > 0.4F) {
|
|
||||||
return SurfaceBuilders.PALLIDIUM_FULL_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
else if (grass > 0.15F) {
|
|
||||||
return SurfaceBuilders.PALLIDIUM_HEAVY_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
else if (grass > -0.15) {
|
|
||||||
return SurfaceBuilders.PALLIDIUM_THIN_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
else if (grass > -0.4F) {
|
|
||||||
return SurfaceBuilders.PALLIDIUM_TINY_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return SurfaceBuilders.UMBRA_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue