Terrain generator (WIP)
This commit is contained in:
parent
c515c3c367
commit
ce88ec23f7
65 changed files with 283 additions and 371 deletions
|
@ -1,9 +1,6 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -32,6 +29,8 @@ import ru.bclib.client.render.BCLRenderLayer;
|
|||
import ru.bclib.interfaces.RenderLayerProvider;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlock, RenderLayerProvider {
|
||||
public static final EnumProperty<Direction> FACING = BlockStateProperties.FACING;
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -38,12 +34,15 @@ import net.minecraft.world.level.material.Fluids;
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import ru.bclib.blocks.BaseBlockNotFull;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.betterend.blocks.entities.BlockEntityHydrothermalVent;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlock, LiquidBlockContainer, SimpleWaterloggedBlock {
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
|
@ -14,6 +11,9 @@ import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public class LumecornSeedBlock extends EndPlantWithAgeBlock {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -51,6 +46,10 @@ import ru.betterend.blocks.EndBlockProperties.CactusBottom;
|
|||
import ru.betterend.interfaces.PottablePlant;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, RenderLayerProvider, PottablePlant {
|
||||
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
|
@ -21,6 +18,9 @@ import ru.betterend.blocks.basis.EndPlantBlock;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public class SmallAmaranitaBlock extends EndPlantBlock {
|
||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 10, 12);
|
||||
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -43,6 +37,11 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.betterend.interfaces.PottablePlant;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLayerProvider, BonemealableBlock, PottablePlant {
|
||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -36,6 +33,9 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public class VentBubbleColumnBlock extends Block implements BucketPickup, LiquidBlockContainer {
|
||||
public VentBubbleColumnBlock() {
|
||||
super(FabricBlockSettings.of(Material.BUBBLE_COLUMN).noOcclusion().noCollission().noDrops());
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -28,6 +26,8 @@ import ru.bclib.blocks.BaseBlockNotFull;
|
|||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.client.models.ModelsHelper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class EndLanternBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, LiquidBlockContainer {
|
||||
public static final BooleanProperty IS_FLOOR = BlockProperties.IS_FLOOR;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import ru.bclib.blocks.FeatureSaplingBlock;
|
||||
import ru.betterend.interfaces.PottablePlant;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class PottableFeatureSapling extends FeatureSaplingBlock implements PottablePlant {
|
||||
public PottableFeatureSapling(Function<BlockState, Feature<?>> featureSupplier) {
|
||||
super(featureSupplier);
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
package ru.betterend.blocks.entities;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import net.fabricmc.fabric.api.registry.FuelRegistry;
|
||||
|
@ -46,6 +41,10 @@ import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
|
|||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||
import ru.betterend.registry.EndBlockEntities;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, RecipeHolder, StackedContentsCompatible {
|
||||
|
||||
private static final int[] TOP_SLOTS = new int[] {0, 1};
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.integration.byg.biomes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
|
@ -18,6 +16,8 @@ import ru.betterend.integration.byg.features.BYGFeatures;
|
|||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NightshadeRedwoods extends EndBiome.Config {
|
||||
public NightshadeRedwoods() {
|
||||
super("nightshade_redwoods");
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.integration.byg.biomes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
|
@ -25,6 +22,9 @@ import ru.betterend.integration.byg.features.BYGFeatures;
|
|||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
public class OldBulbisGardens extends EndBiome.Config {
|
||||
public OldBulbisGardens() {
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
package ru.betterend.integration.rei;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.shedaniel.math.Point;
|
||||
|
@ -20,8 +14,12 @@ import me.shedaniel.rei.api.common.entry.EntryStack;
|
|||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class REIAlloyingCategory implements DisplayCategory<REIAlloyingDisplay> {
|
||||
private final EntryStack ICON;
|
||||
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
package ru.betterend.integration.rei;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.shedaniel.math.Point;
|
||||
|
@ -25,8 +18,13 @@ import net.minecraft.world.item.BlockItem;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.betterend.blocks.basis.EndAnvilBlock;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class REIAnvilCategory implements DisplayCategory<REIAnvilDisplay> {
|
||||
private final EntryStack<?>[] ANVILS;
|
||||
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
package ru.betterend.integration.rei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
|
@ -18,9 +12,13 @@ import me.shedaniel.rei.api.common.entry.EntryStack;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class REIInfusionCategory implements DisplayCategory<REIInfusionDisplay> {
|
||||
|
||||
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
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;
|
||||
|
@ -26,6 +22,9 @@ import ru.betterend.recipe.builders.AlloyingRecipe;
|
|||
import ru.betterend.recipe.builders.InfusionRecipe;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
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");
|
||||
|
|
5
src/main/java/ru/betterend/interfaces/TargetChecker.java
Normal file
5
src/main/java/ru/betterend/interfaces/TargetChecker.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package ru.betterend.interfaces;
|
||||
|
||||
public interface TargetChecker {
|
||||
boolean isTarget();
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -18,6 +16,8 @@ import ru.betterend.BetterEnd;
|
|||
import ru.betterend.registry.EndItems;
|
||||
import ru.betterend.util.LangUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GuideBookItem extends ModelProviderItem {
|
||||
public final static ResourceLocation BOOK_ID = BetterEnd.makeID("guidebook");
|
||||
public static final Item GUIDE_BOOK = EndItems.getItemRegistry().register(BOOK_ID, new GuideBookItem());
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
|
@ -19,6 +16,9 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
@Mixin(EndCityFeature.class)
|
||||
public class EndCityFeatureMixin {
|
||||
@Inject(method = "pieceGeneratorSupplier", at = @At("HEAD"), cancellable = true)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -26,6 +23,9 @@ import ru.bclib.util.StructureHelper;
|
|||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
@Mixin(EndPodiumFeature.class)
|
||||
public class EndPodiumFeatureMixin {
|
||||
private static BlockPos be_portalPosition;
|
||||
|
|
|
@ -1,188 +1,26 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.NoiseColumn;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.levelgen.Beardifier;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.NoiseChunk;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.StructureSettings;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import net.minecraft.world.level.levelgen.SurfaceSystem;
|
||||
import net.minecraft.world.level.levelgen.WorldGenerationContext;
|
||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import ru.betterend.world.generator.EndNoiseFiller;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
import ru.betterend.world.generator.TerrainGenerator;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(NoiseBasedChunkGenerator.class)
|
||||
public abstract class NoiseBasedChunkGeneratorMixin extends ChunkGenerator {
|
||||
@Final
|
||||
@Shadow
|
||||
protected Supplier<NoiseGeneratorSettings> settings;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
protected BlockState defaultBlock;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private SurfaceSystem surfaceSystem;
|
||||
|
||||
public NoiseBasedChunkGeneratorMixin(BiomeSource populationSource, BiomeSource biomeSource, StructureSettings structuresConfig, long worldSeed) {
|
||||
super(populationSource, biomeSource, structuresConfig, worldSeed);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>(Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/biome/BiomeSource;Lnet/minecraft/world/level/biome/BiomeSource;JLjava/util/function/Supplier;)V", at = @At("TAIL"))
|
||||
private void beOnInit(Registry registry, BiomeSource biomeSource, BiomeSource biomeSource2, long seed, Supplier supplier, CallbackInfo ci) {
|
||||
private void be_onInit(Registry registry, BiomeSource biomeSource, BiomeSource biomeSource2, long seed, Supplier supplier, CallbackInfo ci) {
|
||||
TerrainGenerator.initNoise(seed);
|
||||
if (GeneratorOptions.useNewGenerator() && settings.get().stable(NoiseGeneratorSettings.END)) {
|
||||
EndNoiseFiller.INSTANCE.setBiomeSource(biomeSource);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: 1.18 Find another place for this
|
||||
// @Inject(method = "fillNoiseColumn([DIIII)V", at = @At("HEAD"), cancellable = true, allow = 2)
|
||||
// private void be_fillNoiseColumn(double[] buffer, int x, int z, int k, int l, CallbackInfo info) {
|
||||
// if (GeneratorOptions.useNewGenerator() && settings.get().stable(NoiseGeneratorSettings.END)) {
|
||||
// TerrainGenerator.fillTerrainDensity(buffer, x, z, getBiomeSource());
|
||||
// info.cancel();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Inject(method = "buildSurface", at = @At("HEAD"), cancellable = true)
|
||||
private void be_buildSurface(WorldGenRegion worldGenRegion, StructureFeatureManager structureFeatureManager, ChunkAccess chunkAccess, CallbackInfo info) {
|
||||
//NoiseChunk noiseChunk = chunkAccess.getOrCreateNoiseChunk(this.sampler, () -> new Beardifier(structureFeatureManager, chunkAccess), noiseGeneratorSettings, this.globalFluidPicker, Blender.of(worldGenRegion));
|
||||
/*WorldGenerationContext worldGenerationContext = new WorldGenerationContext(this, worldGenRegion);
|
||||
NoiseGeneratorSettings noiseGeneratorSettings = this.settings.get();
|
||||
surfaceSystem.buildSurface(
|
||||
worldGenRegion.getBiomeManager(),
|
||||
worldGenRegion.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY),
|
||||
noiseGeneratorSettings.useLegacyRandomSource(),
|
||||
worldGenerationContext,
|
||||
chunkAccess,
|
||||
null,
|
||||
noiseGeneratorSettings.surfaceRule()
|
||||
);*/
|
||||
//System.out.println("Build surface!");
|
||||
}
|
||||
|
||||
@Inject(method = "fillFromNoise", at = @At("HEAD"), cancellable = true)
|
||||
private void be_fillFromNoise(Executor executor, Blender blender, StructureFeatureManager structureFeatureManager, ChunkAccess chunkAccess2, CallbackInfoReturnable<CompletableFuture<ChunkAccess>> info) {
|
||||
info.setReturnValue(CompletableFuture.supplyAsync(
|
||||
Util.wrapThreadWithTaskName(
|
||||
"wgen_fill_noise",
|
||||
() -> this.fill(chunkAccess2)
|
||||
),
|
||||
Util.backgroundExecutor()
|
||||
));
|
||||
}
|
||||
|
||||
private ChunkAccess fill(ChunkAccess chunkAccess) {
|
||||
ChunkPos chunkPos = chunkAccess.getPos();
|
||||
|
||||
int px = chunkPos.x << 1;
|
||||
int pz = chunkPos.z << 1;
|
||||
double[][][] noiseColumns = new double[3][3][33];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
TerrainGenerator.fillTerrainDensity(noiseColumns[i][j], px + i, pz + j, biomeSource);
|
||||
}
|
||||
}
|
||||
|
||||
// Testing
|
||||
BlockState grass = Blocks.GRASS_BLOCK.defaultBlockState();
|
||||
|
||||
Heightmap heightmap = chunkAccess.getOrCreateHeightmapUnprimed(Heightmap.Types.OCEAN_FLOOR_WG);
|
||||
Heightmap heightmap2 = chunkAccess.getOrCreateHeightmapUnprimed(Heightmap.Types.WORLD_SURFACE_WG);
|
||||
|
||||
short maxHeight = (short) (Math.min(127, chunkAccess.getMaxBuildHeight()) - chunkAccess.getMinBuildHeight());
|
||||
short start = (short) ((-chunkAccess.getMinBuildHeight()) >> 4);
|
||||
short end = (short) (maxHeight >> 4);
|
||||
|
||||
//IntStream.range(start, end).parallel().forEach(sectionIndex -> {
|
||||
for (short sectionIndex = start; sectionIndex <= end; sectionIndex++) {
|
||||
LevelChunkSection section = chunkAccess.getSection(sectionIndex);
|
||||
for (byte y = 0; y < 16; y++) {
|
||||
short iy = (short) ((y >> 2) | ((sectionIndex - start) << 2));
|
||||
float dy = (y & 3) / 4F;
|
||||
for (byte x = 0; x < 16; x++) {
|
||||
float dx = (x & 7) / 8F;
|
||||
byte ix = (byte) (x >> 3);
|
||||
for (byte z = 0; z < 16; z++) {
|
||||
float dz = (z & 7) / 8F;
|
||||
byte iz = (byte) (z >> 3);
|
||||
|
||||
float a = (float) noiseColumns[ix][iz][iy];
|
||||
float b = (float) noiseColumns[ix + 1][iz][iy];
|
||||
float c = (float) noiseColumns[ix][iz][iy + 1];
|
||||
float d = (float) noiseColumns[ix + 1][iz][iy + 1];
|
||||
|
||||
float e = (float) noiseColumns[ix][iz + 1][iy];
|
||||
float f = (float) noiseColumns[ix + 1][iz + 1][iy];
|
||||
float g = (float) noiseColumns[ix][iz + 1][iy + 1];
|
||||
float h = (float) noiseColumns[ix + 1][iz + 1][iy + 1];
|
||||
|
||||
a = Mth.lerp(dx, a, b);
|
||||
b = Mth.lerp(dx, c, d);
|
||||
c = Mth.lerp(dx, e, f);
|
||||
d = Mth.lerp(dx, g, h);
|
||||
|
||||
a = Mth.lerp(dy, a, b);
|
||||
b = Mth.lerp(dy, c, d);
|
||||
|
||||
if (Mth.lerp(dz, a, b) > 0) {
|
||||
section.setBlockState(x, y, z, defaultBlock);
|
||||
heightmap.update(x, y, z, defaultBlock);
|
||||
heightmap2.update(x, y, z, defaultBlock);
|
||||
}
|
||||
else if (iy > 0) {
|
||||
byte py = (byte) ((y - 1) & 15);
|
||||
LevelChunkSection section2 = y == 0 ? chunkAccess.getSection(sectionIndex - 1) : section;
|
||||
if (section2.getBlockState(x, py, z).equals(defaultBlock)) {
|
||||
section2.setBlockState(x, py, z, grass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//});
|
||||
|
||||
return chunkAccess;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import net.minecraft.world.level.levelgen.NoiseChunk;
|
||||
import net.minecraft.world.level.levelgen.NoiseSettings;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(NoiseChunk.class)
|
||||
public interface NoiseChunkAccessor {
|
||||
@Accessor("noiseSettings")
|
||||
NoiseSettings bnv_getNoiseSettings();
|
||||
|
||||
@Accessor("cellCountXZ")
|
||||
int bnv_getCellCountXZ();
|
||||
|
||||
@Accessor("cellCountY")
|
||||
int bnv_getCellCountY();
|
||||
|
||||
@Accessor("firstCellZ")
|
||||
int bnv_getFirstCellZ();
|
||||
|
||||
@Accessor("cellNoiseMinY")
|
||||
int bnv_getCellNoiseMinY();
|
||||
}
|
28
src/main/java/ru/betterend/mixin/common/NoiseChunkMixin.java
Normal file
28
src/main/java/ru/betterend/mixin/common/NoiseChunkMixin.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import net.minecraft.world.level.levelgen.Aquifer;
|
||||
import net.minecraft.world.level.levelgen.NoiseChunk;
|
||||
import net.minecraft.world.level.levelgen.NoiseChunk.NoiseFiller;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.NoiseSampler;
|
||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import ru.betterend.interfaces.TargetChecker;
|
||||
|
||||
@Mixin(NoiseChunk.class)
|
||||
public class NoiseChunkMixin implements TargetChecker {
|
||||
private boolean bnv_isNetherGenerator;
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void bnv_onNoiseChunkInit(int i, int j, int k, NoiseSampler noiseSampler, int l, int m, NoiseFiller noiseFiller, NoiseGeneratorSettings noiseGeneratorSettings, Aquifer.FluidPicker fluidPicker, Blender blender, CallbackInfo info) {
|
||||
bnv_isNetherGenerator = noiseGeneratorSettings.stable(NoiseGeneratorSettings.END);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTarget() {
|
||||
return bnv_isNetherGenerator;
|
||||
}
|
||||
}
|
|
@ -1,24 +1,54 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import net.minecraft.world.level.levelgen.NoiseChunk;
|
||||
import net.minecraft.world.level.levelgen.NoiseChunk.NoiseFiller;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import net.minecraft.world.level.levelgen.NoiseSettings;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import ru.betterend.world.generator.EndNoiseFiller;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import ru.betterend.interfaces.TargetChecker;
|
||||
|
||||
@Mixin(NoiseChunk.NoiseInterpolator.class)
|
||||
public class NoiseInterpolatorMixin {
|
||||
/*@Redirect(
|
||||
method = "fillSlice([[DI)V",
|
||||
at = @At(
|
||||
value = "FIELD",
|
||||
target = "Lnet/minecraft/world/level/levelgen/NoiseChunk$NoiseInterpolator;noiseFiller:Lnet/minecraft/world/level/levelgen/NoiseChunk$NoiseFiller;",
|
||||
opcode = Opcodes.GETFIELD
|
||||
)
|
||||
)
|
||||
private NoiseFiller getFiller(NoiseChunk.NoiseInterpolator interpolator) {
|
||||
return EndNoiseFiller.INSTANCE;
|
||||
}*/
|
||||
@Final
|
||||
@Shadow(aliases = "this$0")
|
||||
private NoiseChunk this$0;
|
||||
|
||||
@Inject(method = "fillSlice", at = @At("HEAD"), cancellable = true)
|
||||
private void be_fillSlice(double[][] data, int x, CallbackInfo info) {
|
||||
if (!TargetChecker.class.cast(this$0).isTarget()) {
|
||||
return;
|
||||
}
|
||||
|
||||
info.cancel();
|
||||
|
||||
NoiseChunkAccessor accessor = NoiseChunkAccessor.class.cast(this$0);
|
||||
NoiseSettings noiseSettings = accessor.bnv_getNoiseSettings();
|
||||
|
||||
final int sizeY = noiseSettings.getCellHeight();
|
||||
final int sizeXZ = noiseSettings.getCellWidth();
|
||||
final int cellsY = accessor.bnv_getCellCountY() + 1;
|
||||
final int cellsXZ = accessor.bnv_getCellCountXZ() + 1;
|
||||
final int firstCellZ = accessor.bnv_getFirstCellZ();
|
||||
final int cellNoiseMinY = accessor.bnv_getCellNoiseMinY();
|
||||
|
||||
x *= sizeXZ;
|
||||
|
||||
for (int cellXZ = 0; cellXZ < cellsXZ; ++cellXZ) {
|
||||
int z = (firstCellZ + cellXZ) * sizeXZ;
|
||||
for (int cellY = 0; cellY < cellsY; ++cellY) {
|
||||
int y = (cellY + cellNoiseMinY) * sizeY;
|
||||
data[cellXZ][cellY] = be_calculateNoise(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float be_calculateNoise(int x, int y, int z) {
|
||||
float gradient = (64 - y) * 0.1F;
|
||||
float sinX = (float) Math.sin(x * 0.1);
|
||||
float sinZ = (float) Math.sin(z * 0.1);
|
||||
return gradient + sinX + sinZ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package ru.betterend.util;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -23,6 +19,9 @@ import ru.betterend.blocks.BlueVineBlock;
|
|||
import ru.betterend.blocks.basis.FurBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class BlockFixer {
|
||||
private static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class EmptyAuroraCaveBiome extends EndCaveBiome.Config {
|
||||
public static class Biome extends EndCaveBiome {
|
||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class EmptyEndCaveBiome extends EndCaveBiome.Config {
|
||||
public static class Biome extends EndCaveBiome {
|
||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome) {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
|
||||
public static class Biome extends EndCaveBiome {
|
||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome) {
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
@ -19,6 +16,9 @@ import ru.betterend.registry.EndSounds;
|
|||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.features.terrain.caves.CaveChunkPopulatorFeature;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class EndCaveBiome extends EndBiome {
|
||||
public static abstract class Config extends EndBiome.Config {
|
||||
protected Config(String name) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -11,6 +9,8 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class JadeCaveBiome extends EndCaveBiome.Config {
|
||||
public static class Biome extends EndCaveBiome {
|
||||
private static final OpenSimplexNoise WALL_NOISE = new OpenSimplexNoise("jade_cave".hashCode());
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -13,6 +11,8 @@ import ru.betterend.registry.EndFeatures;
|
|||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class LushAuroraCaveBiome extends EndCaveBiome.Config {
|
||||
public static class Biome extends EndCaveBiome {
|
||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
|
@ -11,6 +9,8 @@ import ru.betterend.registry.EndFeatures;
|
|||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
|
||||
public static class Biome extends EndCaveBiome {
|
||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
|
@ -27,6 +25,8 @@ import ru.bclib.world.features.NBTStructureFeature;
|
|||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class CrashedShipFeature extends NBTStructureFeature {
|
||||
private static final StructureProcessor REPLACER;
|
||||
private static final String STRUCTURE_PATH = "/data/minecraft/structures/end_city/ship.nbt";
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -20,6 +18,8 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
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);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -20,6 +18,8 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
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);
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
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;
|
||||
|
@ -23,6 +18,10 @@ import ru.betterend.registry.EndBiomes;
|
|||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public class FloatingSpireFeature extends SpireFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
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;
|
||||
|
@ -41,6 +37,10 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
|
||||
import java.util.Optional;
|
||||
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;
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
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;
|
||||
|
@ -31,6 +25,11 @@ import ru.betterend.registry.EndBiomes;
|
|||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SpireFeature extends DefaultFeature {
|
||||
protected static final Function<BlockState, Boolean> REPLACE;
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
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;
|
||||
|
@ -26,6 +22,9 @@ 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();
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
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;
|
||||
|
@ -23,6 +19,9 @@ 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();
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
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;
|
||||
|
@ -22,6 +16,11 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class CaveChunkPopulatorFeature extends DefaultFeature {
|
||||
private Supplier<EndCaveBiome> supplier;
|
||||
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
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;
|
||||
|
@ -30,6 +24,11 @@ import ru.betterend.registry.EndBiomes;
|
|||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
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();
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
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;
|
||||
|
@ -30,6 +23,12 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
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;
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
package ru.betterend.world.generator;
|
||||
|
||||
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.api.biomes.BiomeAPI;
|
||||
|
@ -16,6 +9,12 @@ import ru.bclib.util.MHelper;
|
|||
import ru.bclib.world.biomes.BCLBiome;
|
||||
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;
|
||||
|
||||
public class TerrainGenerator {
|
||||
private static final Map<Point, TerrainBoolCache> TERRAIN_BOOL_CACHE_MAP = Maps.newHashMap();
|
||||
private static final ReentrantLock LOCKER = new ReentrantLock();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
|
@ -19,6 +17,8 @@ import ru.bclib.world.structures.BCLStructureFeature;
|
|||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.world.structures.piece.NBTPiece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EternalPortalStructure extends FeatureBaseStructure {
|
||||
private static final ResourceLocation STRUCTURE_ID = BetterEnd.makeID("portal/eternal_portal");
|
||||
private static final StructureTemplate STRUCTURE = StructureHelper.readStructure(STRUCTURE_ID);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
@ -14,6 +12,8 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
|||
import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplier;
|
||||
import ru.bclib.world.structures.BCLStructureFeature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class FeatureBaseStructure extends StructureFeature<NoneFeatureConfiguration> {
|
||||
protected static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
|
@ -22,6 +18,10 @@ import ru.bclib.util.MHelper;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.structures.piece.VoxelPiece;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class GiantIceStarStructure extends SDFStructureFeature {
|
||||
private static final float minSize = 20;
|
||||
private static final float maxSize = 35;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -31,6 +28,9 @@ import ru.betterend.blocks.basis.FurBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class GiantMossyGlowshroomStructure extends SDFStructureFeature {
|
||||
public GiantMossyGlowshroomStructure() {
|
||||
super(GiantMossyGlowshroomStructure::generatePieces);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
@ -15,6 +13,8 @@ import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilde
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.world.structures.piece.LakePiece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MegaLakeSmallStructure extends FeatureBaseStructure {
|
||||
public MegaLakeSmallStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
@ -15,6 +13,8 @@ import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilde
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.world.structures.piece.LakePiece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MegaLakeStructure extends FeatureBaseStructure {
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
@ -15,6 +13,8 @@ import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilde
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.world.structures.piece.CrystalMountainPiece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MountainStructure extends FeatureBaseStructure {
|
||||
|
||||
public MountainStructure() {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
@ -18,6 +16,8 @@ import ru.bclib.util.MHelper;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.structures.piece.PaintedMountainPiece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PaintedMountainStructure extends FeatureBaseStructure {
|
||||
private static final BlockState[] VARIANTS;
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.world.structures.features;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
@ -16,6 +13,9 @@ import ru.bclib.sdf.SDF;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.world.structures.piece.VoxelPiece;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public abstract class SDFStructureFeature extends FeatureBaseStructure {
|
||||
public SDFStructureFeature(PieceGenerator<NoneFeatureConfiguration> generator) {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.levelgen.feature.StructurePieceType;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.StructurePiece;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -19,6 +17,8 @@ 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;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -25,6 +23,8 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.registry.EndStructures;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class CrystalMountainPiece extends MountainPiece {
|
||||
private BlockState top;
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
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;
|
||||
|
@ -34,6 +30,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.registry.EndStructures;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
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();
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
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;
|
||||
|
@ -20,6 +16,9 @@ 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;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -22,6 +20,8 @@ import ru.bclib.util.StructureHelper;
|
|||
import ru.betterend.registry.EndStructures;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class NBTPiece extends BasePiece {
|
||||
private ResourceLocation structureID;
|
||||
private Rotation rotation;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -21,6 +19,8 @@ import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSeriali
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PaintedMountainPiece extends MountainPiece {
|
||||
private BlockState[] slises;
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
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.world.level.ChunkPos;
|
||||
|
@ -14,6 +11,9 @@ import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSeriali
|
|||
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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue