Fixed all remaining compile errors (mind the TODOs, a lot of things are disabled)

This commit is contained in:
Frank 2021-12-07 17:42:18 +01:00
parent 108d2bd710
commit 6c89c76c26
34 changed files with 241 additions and 430 deletions

View file

@ -29,7 +29,6 @@ import ru.betterend.util.BonemealPlants;
import ru.betterend.util.LootTableUtil;
import ru.betterend.world.generator.GeneratorOptions;
import ru.betterend.world.generator.TerrainGenerator;
import ru.betterend.world.surface.SurfaceBuilders;
public class BetterEnd implements ModInitializer {
public static final String MOD_ID = "betterend";
@ -44,7 +43,6 @@ public class BetterEnd implements ModInitializer {
EndBlockEntities.register();
EndFeatures.register();
EndEntities.register();
SurfaceBuilders.register();
EndBiomes.register();
EndTags.register();
EndEnchantments.register();

View file

@ -4,19 +4,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
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.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class DragonTreeSaplingBlock extends PottableFeatureSapling {
public DragonTreeSaplingBlock() {
super();
}
@Override
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.DRAGON_TREE.getFeature();
super((state)->EndFeatures.DRAGON_TREE.getFeature());
}
@Override

View file

@ -4,15 +4,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
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.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class HelixTreeSaplingBlock extends PottableFeatureSapling {
@Override
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.HELIX_TREE.getFeature();
public HelixTreeSaplingBlock() {
super((state)->EndFeatures.HELIX_TREE.getFeature());
}
@Override

View file

@ -4,19 +4,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
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.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class LacugroveSaplingBlock extends PottableFeatureSapling {
public LacugroveSaplingBlock() {
super();
}
@Override
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.LACUGROVE.getFeature();
super((state)->EndFeatures.LACUGROVE.getFeature());
}
@Override

View file

@ -4,19 +4,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
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.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class LucerniaSaplingBlock extends PottableFeatureSapling {
public LucerniaSaplingBlock() {
super();
}
@Override
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.LUCERNIA.getFeature();
super((state)->EndFeatures.LUCERNIA.getFeature());
}
@Override

View file

@ -4,19 +4,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
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.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling {
public MossyGlowshroomSaplingBlock() {
super(7);
}
@Override
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.MOSSY_GLOWSHROOM.getFeature();
super(7, (state)->EndFeatures.MOSSY_GLOWSHROOM.getFeature());
}
@Override

View file

@ -1,16 +1,18 @@
package ru.betterend.integration.rei;
import java.util.List;
import java.util.stream.Collectors;
import com.google.common.collect.Lists;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
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.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks;
import me.shedaniel.rei.plugin.common.DefaultPlugin;
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
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.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
public class REIPlugin implements REIClientPlugin {
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(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new);
FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
if (time >= 2000) {
final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
registry.add(new REIAlloyingFuelDisplay(list, time));
}
});
//TODO: 1.18 REI fix this
// FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
// if (time >= 2000) {
// final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
// registry.add(new REIAlloyingFuelDisplay(list, time));
// }
// });
}
@Override

View file

@ -429,8 +429,8 @@ public class EndBlocks {
public static final Block SILK_MOTH_HIVE = registerBlock("silk_moth_hive", new SilkMothHiveBlock());
// Ores //
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 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));
// Materials //
public static final MetalMaterial THALLASIUM = MetalMaterial.makeNormal(

View file

@ -80,7 +80,6 @@ import ru.betterend.world.features.trees.MossyGlowshroomFeature;
import ru.betterend.world.features.trees.PythadendronTreeFeature;
import ru.betterend.world.features.trees.TenaneaFeature;
import ru.betterend.world.features.trees.UmbrellaTreeFeature;
import ru.betterend.world.surface.UmbraSurfaceBuilder;
public class EndFeatures {
// Trees //
@ -218,7 +217,8 @@ public class EndFeatures {
"umbralith_arch",
new ArchFeature(
EndBlocks.UMBRALITH.stone,
UmbraSurfaceBuilder::getSurfaceState
//TODO: 1.18 this needs to change to a dynamic block
(pos)->Blocks.END_STONE.defaultBlockState() //UmbraSurfaceBuilder::getSurfaceState
),
10);
public static final BCLFeature THIN_UMBRALITH_ARCH = registerChanced("thin_umbralith_arch", new ThinArchFeature(EndBlocks.UMBRALITH.stone), 15);

View file

@ -6,16 +6,23 @@ import net.minecraft.data.worldgen.StructureFeatures;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
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.interfaces.StructureFeaturesAccessor;
import ru.bclib.world.biomes.BCLBiome;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
public class EndBiome extends BCLBiome {
public abstract static class Config {
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;

View file

@ -21,7 +21,8 @@ public class FoggyMushroomlandBiome extends EndBiome.Config {
.fogColor(41, 122, 173)
.fogDensity(3)
.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)
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
.loop(EndSounds.AMBIENT_FOGGY_MUSHROOMLAND)

View file

@ -22,7 +22,8 @@ public class MegalakeBiome extends EndBiome.Config {
.fogDensity(1.75F)
.music(EndSounds.MUSIC_WATER)
.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)
//TODO: 1.18 removed
//.depth(0F)

View file

@ -18,7 +18,8 @@ public class NeonOasisBiome extends EndBiome.Config {
.fogColor(226, 239, 168)
.fogDensity(2)
.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)
.particles(ParticleTypes.WHITE_ASH, 0.01F)
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)

View file

@ -1,5 +1,7 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
@ -17,8 +19,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import java.util.Random;
public class DesertLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
@ -123,10 +123,8 @@ public class DesertLakeFeature extends DefaultFeature {
}
pos = POS.below();
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
state = world.getBiome(pos)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(
@ -198,10 +196,8 @@ public class DesertLakeFeature extends DefaultFeature {
}
else if (y < waterLevel) {
if (world.isEmptyBlock(POS.above())) {
state = world.getBiome(POS)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
BlocksHelper.setWithoutUpdate(
world,
POS,

View file

@ -1,5 +1,7 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
@ -17,8 +19,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import java.util.Random;
public class EndLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
@ -123,10 +123,12 @@ public class EndLakeFeature extends DefaultFeature {
}
pos = POS.below();
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
state = world.getBiome(pos)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState();
// state = world.getBiome(pos)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(
@ -193,10 +195,12 @@ public class EndLakeFeature extends DefaultFeature {
// Make border
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
if (world.isEmptyBlock(POS.above())) {
state = world.getBiome(POS)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState();
// state = world.getBiome(POS)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
BlocksHelper.setWithoutUpdate(
world,
POS,

View file

@ -1,6 +1,11 @@
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 net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.WorldGenLevel;
@ -17,9 +22,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import java.util.List;
import java.util.Random;
public class FloatingSpireFeature extends SpireFeature {
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
@ -62,13 +64,16 @@ public class FloatingSpireFeature extends SpireFeature {
if (random.nextInt(16) == 0) {
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()) {
return world.getBiome(info.getPos())
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getUnderMaterial();
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
// return world.getBiome(info.getPos())
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getUnderMaterial();
}
return info.getState();
});
@ -77,7 +82,7 @@ public class FloatingSpireFeature extends SpireFeature {
support.forEach((bpos) -> {
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<>(world, chunkGenerator, random, bpos, null));
.place(new FeaturePlaceContext<>(Optional.empty(), world, chunkGenerator, random, bpos, null));
}
});

View file

@ -1,5 +1,9 @@
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 net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
@ -37,9 +41,6 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import ru.betterend.util.BlockFixer;
import java.util.Random;
import java.util.function.Function;
public class GeyserFeature extends DefaultFeature {
protected static final Function<BlockState, Boolean> REPLACE1;
protected static final Function<BlockState, Boolean> REPLACE2;
@ -259,7 +260,7 @@ public class GeyserFeature extends DefaultFeature {
}
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;
BlockPos start = pos.offset(-distance, -halfHeight - 15 - distance, -distance);

View file

@ -1,6 +1,12 @@
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 net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
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.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
import ru.bclib.sdf.operator.SDFSmoothUnion;
@ -24,10 +30,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
public class SpireFeature extends DefaultFeature {
protected static final Function<BlockState, Boolean> REPLACE;
@ -65,13 +67,17 @@ public class SpireFeature extends DefaultFeature {
if (random.nextInt(16) == 0) {
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()) {
return world.getBiome(info.getPos())
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getUnderMaterial();
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
// return world.getBiome(info.getPos())
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getUnderMaterial();
}
return info.getState();
}).fillRecursive(world, center);
@ -79,7 +85,7 @@ public class SpireFeature extends DefaultFeature {
support.forEach((bpos) -> {
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<>(world, chunkGenerator, random, bpos, null));
.place(new FeaturePlaceContext<>(Optional.empty(), world, chunkGenerator, random, bpos, null));
}
});

View file

@ -1,6 +1,10 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -22,9 +26,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import java.util.Random;
import java.util.Set;
public class SulphuricCaveFeature extends DefaultFeature {
private static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
@ -167,7 +168,8 @@ public class SulphuricCaveFeature extends DefaultFeature {
state = world.getBlockState(mut);
while (state.is(Blocks.WATER)) {
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));
mut.setY(mut.getY() + 1);
state = world.getBlockState(mut);

View file

@ -1,6 +1,10 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -19,9 +23,6 @@ import ru.betterend.blocks.SulphurCrystalBlock;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import java.util.Random;
import java.util.Set;
public class SulphuricLakeFeature extends DefaultFeature {
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
private static final MutableBlockPos POS = new MutableBlockPos();
@ -75,7 +76,8 @@ public class SulphuricLakeFeature extends DefaultFeature {
else {
if (!isAbsoluteBorder(world, POS)) {
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());
if (random.nextBoolean()) {
brimstone.add(POS.below(2));

View file

@ -1,6 +1,12 @@
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 net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
@ -16,10 +22,6 @@ import ru.bclib.world.features.DefaultFeature;
import ru.betterend.util.BlockFixer;
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 {
private Supplier<EndCaveBiome> supplier;
@ -40,7 +42,8 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
MutableBlockPos max = new MutableBlockPos().set(pos);
fillSets(sx, sz, world.getChunk(pos), floorPositions, ceilPositions, min, max);
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);
placeCeil(world, biome, ceilPositions, random);
BlockFixer.fixBlocks(world, min, max);
@ -111,7 +114,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
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) {
Feature<?> feature = biome.getCeilFeature(random);
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));
}
}
});

View file

@ -1,7 +1,13 @@
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.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
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.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.api.biomes.BiomeAPI;
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.MHelper;
import ru.bclib.world.biomes.BCLBiome;
@ -25,10 +30,6 @@ import ru.betterend.registry.EndBiomes;
import ru.betterend.util.BlockFixer;
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 {
protected static final BlockState CAVE_AIR = Blocks.CAVE_AIR.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()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState(); //biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
placeFloor(world, biome, floorPositions, random, surfaceBlock);
placeCeil(world, biome, ceilPositions, random);
placeWalls(world, biome, caveBlocks, random);
@ -99,7 +99,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
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) {
Feature<?> feature = biome.getCeilFeature(random);
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) {
BiomeSetter array = (BiomeSetter) world.getChunk(pos).getBiomes();
if (array != null) {
array.bclib_setBiome(biome.getActualBiome(), pos);
}
//TODO: 1.18 No longer implemented in BCLib
// BiomeSetter array = (BiomeSetter) world.getChunk(pos).getBiomes();
// if (array != null) {
// array.bclib_setBiome(biome.getActualBiome(), pos);
// }
}
private BlockPos findPos(WorldGenLevel world, BlockPos pos, int radius, Random random) {

View file

@ -1,7 +1,14 @@
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.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
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.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.util.BlocksHelper;
import ru.bclib.world.biomes.BCLBiome;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
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 {
private Set<BlockPos> generate(WorldGenLevel world, BlockPos center, Random random) {
int cx = center.getX() >> 4;
@ -166,10 +168,12 @@ public class TunelCaveFeature extends EndCaveFeature {
}
floorSets.forEach((biome, floorPositions) -> {
BlockState surfaceBlock = biome.getBiome()
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState();
// BlockState surfaceBlock = biome.getBiome()
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
placeFloor(world, biome, floorPositions, random, surfaceBlock);
});
ceilSets.forEach((biome, ceilPositions) -> {
@ -197,7 +201,7 @@ public class TunelCaveFeature extends EndCaveFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
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) {
Feature<?> feature = biome.getCeilFeature(random);
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));
}
}
});

View file

@ -1,19 +1,19 @@
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.util.List;
import java.util.Map;
import java.util.Random;
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 {
private static final Map<Point, TerrainBoolCache> TERRAIN_BOOL_CACHE_MAP = Maps.newHashMap();
private static final ReentrantLock LOCKER = new ReentrantLock();
@ -83,21 +83,23 @@ public class TerrainGenerator {
}
private static float getAverageDepth(BiomeSource biomeSource, int x, int z) {
if (getBiome(biomeSource, x, z).getDepth() < 0.1F) {
return 0F;
}
float depth = 0F;
for (int i = 0; i < OFFS.length; i++) {
int px = x + OFFS[i].x;
int pz = z + OFFS[i].y;
depth += getBiome(biomeSource, px, pz).getDepth() * COEF[i];
}
return depth;
//TODO: 1.18 find alternative
// if (getBiome(biomeSource, x, z).getDepth() < 0.1F) {
// return 0F;
// }
// float depth = 0F;
// for (int i = 0; i < OFFS.length; i++) {
// int px = x + OFFS[i].x;
// int pz = z + OFFS[i].y;
// depth += getBiome(biomeSource, px, pz).getDepth() * COEF[i];
// }
// return depth;
return 0;
}
private static Biome getBiome(BiomeSource biomeSource, int x, int z) {
return biomeSource.getNoiseBiome(x, 0, z);
}
// private static Biome getBiome(BiomeSource biomeSource, int x, int z) {
// return biomeSource.getNoiseBiome(x, 0, z);
// }
/**
* Check if this is land

View file

@ -1,24 +1,24 @@
package ru.betterend.world.structures.piece;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.StructureFeatureManager;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.chunk.ChunkGenerator;
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.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndStructures;
import java.util.Random;
public class CavePiece extends BasePiece {
private OpenSimplexNoise noise;
private BlockPos center;
@ -32,12 +32,13 @@ public class CavePiece extends BasePiece {
makeBoundingBox();
}
public CavePiece(ServerLevel serverLevel, CompoundTag tag) {
public CavePiece(StructurePieceSerializationContext type, CompoundTag tag) {
super(EndStructures.CAVE_PIECE, tag);
makeBoundingBox();
}
@Override
@Override
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 z1 = MHelper.max(this.boundingBox.minZ(), blockBox.minZ());

View file

@ -1,5 +1,7 @@
package ru.betterend.world.structures.piece;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
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.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndStructures;
import java.util.Random;
public class CrystalMountainPiece extends MountainPiece {
private BlockState top;
public CrystalMountainPiece(BlockPos center, float radius, float height, Random random, Biome 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) {
super(EndStructures.MOUNTAIN_PIECE, serverLevel, tag);
public CrystalMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
super(EndStructures.MOUNTAIN_PIECE, tag);
}
@Override
protected void fromNbt(CompoundTag tag) {
super.fromNbt(tag);
top = BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
super.fromNbt(tag);//TODO: 1.18 this needs to change to a dynamic block
top = Blocks.END_STONE.defaultBlockState(); //BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
@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 sz = chunkPos.getMinBlockZ();
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) {

View file

@ -1,6 +1,10 @@
package ru.betterend.world.structures.piece;
import java.util.Map;
import java.util.Random;
import com.google.common.collect.Maps;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -8,7 +12,6 @@ import net.minecraft.core.SectionPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.level.ChunkPos;
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.levelgen.Heightmap.Types;
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 ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndStructures;
import java.util.Map;
import java.util.Random;
public class LakePiece extends BasePiece {
private static final BlockState ENDSTONE = Blocks.END_STONE.defaultBlockState();
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
@ -57,7 +58,7 @@ public class LakePiece extends BasePiece {
makeBoundingBox();
}
public LakePiece(ServerLevel serverLevel, CompoundTag tag) {
public LakePiece(StructurePieceSerializationContext type, CompoundTag tag) {
super(EndStructures.LAKE_PIECE, tag);
makeBoundingBox();
}
@ -131,10 +132,12 @@ public class LakePiece extends BasePiece {
)) {
state = chunk.getBlockState(mut.above());
if (state.isAir()) {
state = random.nextBoolean() ? ENDSTONE : world.getBiome(worldPos)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = ENDSTONE;
// state = random.nextBoolean() ? ENDSTONE : world.getBiome(worldPos)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
}
else {
state = state.getFluidState()
@ -147,7 +150,6 @@ public class LakePiece extends BasePiece {
}
}
fixWater(world, chunk, mut, random, sx, sz);
return true;
}
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);
if (bState.isAir()) {
bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
bState = ENDSTONE;
// bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
}
else {
bState = bState.getFluidState()
@ -189,10 +193,12 @@ public class LakePiece extends BasePiece {
mut.setY(y + 1);
BlockState bState = chunk.getBlockState(mut);
if (bState.isAir()) {
bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
bState = ENDSTONE;
// bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
}
else {
bState = bState.getFluidState()
@ -205,7 +211,8 @@ public class LakePiece extends BasePiece {
}
}
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);
}
}
}

View file

@ -1,12 +1,15 @@
package ru.betterend.world.structures.piece;
import java.util.Map;
import java.util.Random;
import com.google.common.collect.Maps;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome;
@ -17,9 +20,6 @@ import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import java.util.Map;
import java.util.Random;
public abstract class MountainPiece extends BasePiece {
protected Map<Integer, Integer> heightmap = Maps.newHashMap();
protected OpenSimplexNoise noise1;
@ -46,7 +46,7 @@ public abstract class MountainPiece extends BasePiece {
makeBoundingBox();
}
public MountainPiece(StructurePieceType type, ServerLevel serverLevel, CompoundTag tag) {
public MountainPiece(StructurePieceType type, CompoundTag tag) {
super(type, tag);
makeBoundingBox();
}

View file

@ -1,11 +1,12 @@
package ru.betterend.world.structures.piece;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.StructureFeatureManager;
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.chunk.ChunkGenerator;
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.StructureTemplate;
import ru.bclib.util.MHelper;
import ru.bclib.util.StructureHelper;
import ru.betterend.registry.EndStructures;
import java.util.Random;
public class NBTPiece extends BasePiece {
private ResourceLocation structureID;
private Rotation rotation;
@ -42,13 +42,14 @@ public class NBTPiece extends BasePiece {
makeBoundingBox();
}
public NBTPiece(ServerLevel serverLevel, CompoundTag tag) {
public NBTPiece(StructurePieceSerializationContext type, CompoundTag tag) {
super(EndStructures.NBT_PIECE, tag);
makeBoundingBox();
}
@Override
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
protected void addAdditionalSaveData(CompoundTag tag) {
super.addAdditionalSaveData(tag);
tag.putString("structureID", structureID.toString());
tag.putInt("rotation", rotation.ordinal());
tag.putInt("mirror", mirror.ordinal());
@ -69,7 +70,7 @@ public class NBTPiece extends BasePiece {
}
@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(
blockBox.minX(),
this.boundingBox.minY(),
@ -90,7 +91,6 @@ public class NBTPiece extends BasePiece {
if (cover) {
StructureHelper.cover(world, bounds, random);
}
return true;
}
private void makeBoundingBox() {

View file

@ -1,11 +1,12 @@
package ru.betterend.world.structures.piece;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.StructureFeatureManager;
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.Types;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndStructures;
import java.util.Random;
public class PaintedMountainPiece extends MountainPiece {
private BlockState[] slises;
@ -29,13 +29,13 @@ public class PaintedMountainPiece extends MountainPiece {
this.slises = slises;
}
public PaintedMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
super(EndStructures.PAINTED_MOUNTAIN_PIECE, serverLevel, tag);
public PaintedMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
super(EndStructures.PAINTED_MOUNTAIN_PIECE, tag);
}
@Override
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
super.addAdditionalSaveData(serverLevel, tag);
protected void addAdditionalSaveData(CompoundTag tag) {
super.addAdditionalSaveData(tag);
ListTag slise = new ListTag();
for (BlockState state : slises) {
slise.add(NbtUtils.writeBlockState(state));
@ -54,7 +54,7 @@ public class PaintedMountainPiece extends MountainPiece {
}
@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 sz = chunkPos.getMinBlockZ();
MutableBlockPos pos = new MutableBlockPos();
@ -101,7 +101,5 @@ public class PaintedMountainPiece extends MountainPiece {
}
}
}
return true;
}
}

View file

@ -1,19 +1,19 @@
package ru.betterend.world.structures.piece;
import java.util.Random;
import java.util.function.Consumer;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.StructureFeatureManager;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.chunk.ChunkGenerator;
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.betterend.registry.EndStructures;
import java.util.Random;
import java.util.function.Consumer;
public class VoxelPiece extends BasePiece {
private StructureWorld world;
@ -24,7 +24,7 @@ public class VoxelPiece extends BasePiece {
this.boundingBox = world.getBounds();
}
public VoxelPiece(ServerLevel level, CompoundTag tag) {
public VoxelPiece(StructurePieceSerializationContext type, CompoundTag tag) {
super(EndStructures.VOXEL_PIECE, tag);
this.boundingBox = world.getBounds();
}

View file

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

View file

@ -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() {
}
}

View file

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