- split biome/terrain locate-s into sub commands to avoid biome ids clashing with terrain type names (badlands for example)
- improved detection of the y value to teleport to after /terra locate-ing - fixed bryce name - remove red sand from sediment tag - finally fixed vines on jungle trees breaking bamboo
This commit is contained in:
parent
b662eb8062
commit
3adbbc0c0e
2
Engine
2
Engine
@ -1 +1 @@
|
||||
Subproject commit 4fe42cd41dd112604ef2879a43f8cfbc1a40e0fa
|
||||
Subproject commit fd12dc3d3913ca610da26c2d8898897647877aa2
|
@ -1 +1 @@
|
||||
Subproject commit 06ee44f3e14bf99f2115f1102645b063ae6ac697
|
||||
Subproject commit 11ec92c8c103ddd1a30edcf0376f6270320e37d8
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"biome.terraforged.brice": "Brice",
|
||||
"biome.terraforged.bryce": "Bryce",
|
||||
"biome.terraforged.cold_steppe": "Cold Steppe",
|
||||
"biome.terraforged.dunes": "Dunes",
|
||||
"biome.terraforged.fir_forest": "Fir Forest",
|
||||
"biome.terraforged.flower_plains": "Flower Plains",
|
||||
"biome.terraforged.frozen_lake": "Frozen Lake",
|
||||
|
@ -124,6 +124,7 @@ public class TerraWorld extends WorldType {
|
||||
public static void init() {
|
||||
Log.info("Registered world type");
|
||||
new TerraWorld("terraforged", TerraChunkGenerator::new);
|
||||
|
||||
if (Environment.isDev()) {
|
||||
Log.info("Registered developer world type");
|
||||
new TerraWorld("terratest", TestChunkGenerator::new);
|
||||
|
@ -12,11 +12,11 @@ import net.minecraft.world.gen.feature.structure.MineshaftConfig;
|
||||
import net.minecraft.world.gen.feature.structure.MineshaftStructure;
|
||||
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
|
||||
|
||||
public class Brice extends BiomeVariant {
|
||||
public class Bryce extends BiomeVariant {
|
||||
|
||||
public Brice() {
|
||||
public Bryce() {
|
||||
super((new Biome.Builder()).surfaceBuilder(SurfaceBuilder.BADLANDS, SurfaceBuilder.RED_SAND_WHITE_TERRACOTTA_GRAVEL_CONFIG).precipitation(Biome.RainType.NONE).category(Biome.Category.MESA).depth(0.1F).scale(0.2F).temperature(2.0F).downfall(0.0F).waterColor(4159204).waterFogColor(329011).parent((String)null));
|
||||
setRegistryName("terraforged", "brice");
|
||||
setRegistryName("terraforged", "bryce");
|
||||
this.addStructure(Feature.MINESHAFT.withConfiguration(new MineshaftConfig(0.004D, MineshaftStructure.Type.MESA)));
|
||||
this.addStructure(Feature.STRONGHOLD.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG));
|
||||
DefaultBiomeFeatures.addCarvers(this);
|
@ -39,7 +39,7 @@ public class ModBiomes {
|
||||
|
||||
private static final ArrayList<BiomeVariant> biomes = new ArrayList<>();
|
||||
|
||||
public static final Biome BRICE = register(new Brice());
|
||||
public static final Biome BRYCE = register(new Bryce());
|
||||
public static final Biome COLD_STEPPE = register(new ColdSteppe());
|
||||
public static final Biome FIR_FOREST = register(new FirForest());
|
||||
public static final Biome FLOWER_PLAINS = register(new FlowerPlains());
|
||||
|
@ -40,7 +40,7 @@ public class SandBiomeModifier extends AbstractMaxHeightModifier {
|
||||
private final Set<Biome> biomes;
|
||||
|
||||
public SandBiomeModifier(TerraContext context) {
|
||||
super(context.seed, context.factory.getClimate(), 10, 1, context.levels.scale(8), context.levels.ground(10), context.levels.ground(25));
|
||||
super(context.seed, context.factory.getClimate(), 16, 2, context.levels.scale(24), context.levels.ground(24), context.levels.ground(48));
|
||||
this.biomes = ForgeRegistries.BIOMES.getValues().stream()
|
||||
.filter(biome -> context.materials.isSand(biome.getSurfaceBuilderConfig().getTop().getBlock()))
|
||||
.collect(Collectors.toSet());
|
||||
|
@ -111,7 +111,7 @@ public class TerraSetupFactory {
|
||||
SurfaceManager manager = new SurfaceManager();
|
||||
manager.replace(Biomes.DEEP_FROZEN_OCEAN.delegate.get(), new IcebergsSurface(context, 30, 30));
|
||||
manager.replace(Biomes.FROZEN_OCEAN.delegate.get(), new IcebergsSurface(context, 20, 15));
|
||||
manager.append(ModBiomes.BRICE, new BriceSurface(context.seed));
|
||||
manager.append(ModBiomes.BRYCE, new BriceSurface(context.seed));
|
||||
manager.replace(
|
||||
new SwampSurface(),
|
||||
Biomes.SWAMP.delegate.get(),
|
||||
|
@ -63,11 +63,11 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.HoverEvent;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.ColumnFuzzedBiomeMagnifier;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
@ -109,14 +109,16 @@ public class TerraCommand {
|
||||
.then(Commands.literal("debug")
|
||||
.executes(TerraCommand::debugBiome))
|
||||
.then(Commands.literal("locate")
|
||||
.then(Commands.argument("biome", BiomeArgType.biome())
|
||||
.executes(TerraCommand::findBiome)
|
||||
.then(Commands.argument("terrain", TerrainArgType.terrain())
|
||||
.executes(TerraCommand::findTerrainAndBiome)))
|
||||
.then(Commands.argument("terrain", TerrainArgType.terrain())
|
||||
.executes(TerraCommand::findTerrain)
|
||||
.then(Commands.literal("biome")
|
||||
.then(Commands.argument("biome", BiomeArgType.biome())
|
||||
.executes(TerraCommand::findTerrainAndBiome))));
|
||||
.executes(TerraCommand::findBiome)))
|
||||
.then(Commands.literal("terrain")
|
||||
.then(Commands.argument("terrain", TerrainArgType.terrain())
|
||||
.executes(TerraCommand::findTerrain)))
|
||||
.then(Commands.literal("both")
|
||||
.then(Commands.argument("biome", BiomeArgType.biome())
|
||||
.then(Commands.argument("terrain", TerrainArgType.terrain())
|
||||
.executes(TerraCommand::findTerrainAndBiome)))));
|
||||
}
|
||||
|
||||
private static int query(CommandContext<CommandSource> context) throws CommandSyntaxException {
|
||||
@ -165,7 +167,6 @@ public class TerraCommand {
|
||||
ServerPlayerEntity player = context.getSource().asPlayer();
|
||||
BlockPos position = player.getPosition();
|
||||
int x = position.getX();
|
||||
int y = position.getY();
|
||||
int z = position.getZ();
|
||||
|
||||
long seed = player.getServerWorld().getSeed();
|
||||
@ -189,13 +190,12 @@ public class TerraCommand {
|
||||
));
|
||||
|
||||
Terrain terrain = TerrainArgType.getTerrain(context, "terrain");
|
||||
Terrain target = getTerrainInstance(terrain, terraContext.terrain);
|
||||
Terrain type = getTerrainInstance(terrain, terraContext.terrain);
|
||||
BlockPos pos = context.getSource().asPlayer().getPosition();
|
||||
UUID playerID = context.getSource().asPlayer().getUniqueID();
|
||||
MinecraftServer server = context.getSource().getServer();
|
||||
WorldGenerator worldGenerator = terraContext.factory.get();
|
||||
IWorldReader reader = context.getSource().asPlayer().getServerWorld();
|
||||
Search search = new TerrainSearchTask(pos, reader, worldGenerator, target);
|
||||
WorldGenerator generator = terraContext.factory.get();
|
||||
Search search = new TerrainSearchTask(pos, type, getChunkGenerator(context), generator);
|
||||
doSearch(server, playerID, search);
|
||||
context.getSource().sendFeedback(new StringTextComponent("Searching..."), false);
|
||||
|
||||
@ -204,7 +204,7 @@ public class TerraCommand {
|
||||
|
||||
private static int findBiome(CommandContext<CommandSource> context) throws CommandSyntaxException {
|
||||
// get the generator's context
|
||||
TerraContext terraContext = getContext(context).orElseThrow(() -> createException(
|
||||
getContext(context).orElseThrow(() -> createException(
|
||||
"Invalid world type",
|
||||
"This command can only be run in a TerraForged world!"
|
||||
));
|
||||
@ -213,8 +213,8 @@ public class TerraCommand {
|
||||
BlockPos pos = context.getSource().asPlayer().getPosition();
|
||||
UUID playerID = context.getSource().asPlayer().getUniqueID();
|
||||
MinecraftServer server = context.getSource().getServer();
|
||||
IWorldReader reader = context.getSource().asPlayer().getServerWorld();
|
||||
Search search = new BiomeSearchTask(pos, reader, biome);
|
||||
ServerWorld world = context.getSource().asPlayer().getServerWorld();
|
||||
Search search = new BiomeSearchTask(pos, biome, world.getChunkProvider().getChunkGenerator(), getBiomeProvider(context));
|
||||
doSearch(server, playerID, search);
|
||||
context.getSource().sendFeedback(new StringTextComponent("Searching..."), false);
|
||||
|
||||
@ -232,13 +232,11 @@ public class TerraCommand {
|
||||
Terrain target = getTerrainInstance(terrain, terraContext.terrain);
|
||||
Biome biome = BiomeArgType.getBiome(context, "biome");
|
||||
BlockPos pos = context.getSource().asPlayer().getPosition();
|
||||
IWorldReader world = context.getSource().asPlayer().getServerWorld();
|
||||
UUID playerID = context.getSource().asPlayer().getUniqueID();
|
||||
MinecraftServer server = context.getSource().getServer();
|
||||
WorldGenerator worldGenerator = terraContext.factory.get();
|
||||
IWorldReader reader = context.getSource().asPlayer().getServerWorld();
|
||||
Search biomeSearch = new BiomeSearchTask(pos, world, biome);
|
||||
Search terrainSearch = new TerrainSearchTask(pos, reader, worldGenerator, target);
|
||||
WorldGenerator generator = terraContext.factory.get();
|
||||
Search biomeSearch = new BiomeSearchTask(pos, biome, getChunkGenerator(context), getBiomeProvider(context));
|
||||
Search terrainSearch = new TerrainSearchTask(pos, target, getChunkGenerator(context), generator);
|
||||
Search search = new BothSearchTask(pos, biomeSearch, terrainSearch);
|
||||
doSearch(server, playerID, search);
|
||||
context.getSource().sendFeedback(new StringTextComponent("Searching..."), false);
|
||||
@ -290,6 +288,10 @@ public class TerraCommand {
|
||||
return find;
|
||||
}
|
||||
|
||||
private static ChunkGenerator<?> getChunkGenerator(CommandContext<CommandSource> context) {
|
||||
return context.getSource().getWorld().getChunkProvider().getChunkGenerator();
|
||||
}
|
||||
|
||||
private static BiomeProvider getBiomeProvider(CommandContext<CommandSource> context) {
|
||||
return (BiomeProvider) context.getSource().getWorld().getChunkProvider().getChunkGenerator().getBiomeProvider();
|
||||
}
|
||||
|
@ -1,18 +1,21 @@
|
||||
package com.terraforged.command.search;
|
||||
|
||||
import com.terraforged.biome.provider.BiomeProvider;
|
||||
import com.terraforged.core.cell.Cell;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
|
||||
public class BiomeSearchTask extends Search {
|
||||
public class BiomeSearchTask extends ChunkGeneratorSearch {
|
||||
|
||||
private final Biome biome;
|
||||
private final IWorldReader reader;
|
||||
private final BiomeProvider biomeProvider;
|
||||
|
||||
public BiomeSearchTask(BlockPos center, IWorldReader reader, Biome biome) {
|
||||
super(center, 128);
|
||||
this.reader = reader;
|
||||
private final Cell cell = new Cell();
|
||||
|
||||
public BiomeSearchTask(BlockPos center, Biome biome, ChunkGenerator<?> generator, BiomeProvider biomeProvider) {
|
||||
super(center, generator);
|
||||
this.biomeProvider = biomeProvider;
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
@ -23,12 +26,7 @@ public class BiomeSearchTask extends Search {
|
||||
|
||||
@Override
|
||||
public boolean test(BlockPos pos) {
|
||||
return reader.getNoiseBiomeRaw(pos.getX() >> 2, pos.getY(), pos.getZ() >> 2) == biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos success(BlockPos.Mutable pos) {
|
||||
pos.setY(reader.getHeight(Heightmap.Type.WORLD_SURFACE_WG, pos.getX(), pos.getZ()));
|
||||
return super.success(pos);
|
||||
biomeProvider.getWorldLookup().applyCell(cell, pos.getX(), pos.getZ());
|
||||
return biomeProvider.getBiome(cell, pos.getX(), pos.getZ()) == biome;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.terraforged.command.search;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
|
||||
public abstract class ChunkGeneratorSearch extends Search {
|
||||
|
||||
private final ChunkGenerator<?> chunkGenerator;
|
||||
|
||||
public ChunkGeneratorSearch(BlockPos center, ChunkGenerator<?> chunkGenerator) {
|
||||
super(center);
|
||||
this.chunkGenerator = chunkGenerator;
|
||||
}
|
||||
|
||||
public ChunkGeneratorSearch(BlockPos center, int minRadius, ChunkGenerator<?> chunkGenerator) {
|
||||
this(center, minRadius, MAX_RADIUS, chunkGenerator);
|
||||
}
|
||||
|
||||
public ChunkGeneratorSearch(BlockPos center, int minRadius, int maxRadius, ChunkGenerator<?> chunkGenerator) {
|
||||
super(center, minRadius, maxRadius);
|
||||
this.chunkGenerator = chunkGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos success(BlockPos.Mutable pos) {
|
||||
pos.setY(chunkGenerator.func_222529_a(pos.getX(), pos.getZ(), Heightmap.Type.WORLD_SURFACE_WG));
|
||||
return pos;
|
||||
}
|
||||
}
|
@ -4,21 +4,18 @@ import com.terraforged.core.cell.Cell;
|
||||
import com.terraforged.world.WorldGenerator;
|
||||
import com.terraforged.world.terrain.Terrain;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
|
||||
public class TerrainSearchTask extends Search {
|
||||
public class TerrainSearchTask extends ChunkGeneratorSearch {
|
||||
|
||||
private final Terrain type;
|
||||
private final IWorldReader reader;
|
||||
private final WorldGenerator generator;
|
||||
private final WorldGenerator worldGenerator;
|
||||
private final Cell cell = new Cell();
|
||||
|
||||
public TerrainSearchTask(BlockPos center, IWorldReader reader, WorldGenerator generator, Terrain type) {
|
||||
super(center, 256);
|
||||
public TerrainSearchTask(BlockPos center, Terrain type, ChunkGenerator<?> chunkGenerator, WorldGenerator worldGenerator) {
|
||||
super(center, 256, chunkGenerator);
|
||||
this.type = type;
|
||||
this.generator = generator;
|
||||
this.reader = reader;
|
||||
this.worldGenerator = worldGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,13 +25,7 @@ public class TerrainSearchTask extends Search {
|
||||
|
||||
@Override
|
||||
public boolean test(BlockPos pos) {
|
||||
generator.getHeightmap().apply(cell, pos.getX(), pos.getZ());
|
||||
worldGenerator.getHeightmap().apply(cell, pos.getX(), pos.getZ());
|
||||
return cell.terrain == type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos success(BlockPos.Mutable pos) {
|
||||
pos.setY(reader.getHeight(Heightmap.Type.WORLD_SURFACE_WG, pos.getX(), pos.getZ()));
|
||||
return super.success(pos);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:sand",
|
||||
"minecraft:gravel",
|
||||
"minecraft:red_sand"
|
||||
"minecraft:gravel"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user