launch on 1.18

This commit is contained in:
dfsek 2021-11-20 20:56:57 -07:00
parent a6edb6aef6
commit a447be3c50
25 changed files with 126 additions and 180 deletions

View File

@ -21,8 +21,8 @@ fun Project.configureCompilation() {
apply(plugin = "idea")
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
}
tasks.withType<JavaCompile> {

@ -1 +1 @@
Subproject commit fa0ce93a457d31de3583e66dbc91539b603db070
Subproject commit 04865538bfa596f361c7364c607b492bbe754451

View File

@ -27,14 +27,4 @@ public interface WorldHandle {
EntityType getEntity(String id);
/**
* Get the locations selected by a player. (Usually via WorldEdit)
*
* @param player Player to get locations for
*
* @return Pair of locations.
*/
default Pair<Vector3, Vector3> getSelectedLocation(Player player) {
throw new UnsupportedOperationException("Cannot get selection on this platform.");
}
}

View File

@ -9,5 +9,5 @@ dependencies {
"shadedImplementation"("com.dfsek.tectonic:yaml:2.1.2")
"shadedImplementation"("org.yaml:snakeyaml:1.27")
"shadedImplementation"("org.ow2.asm:asm:9.0")
"shadedImplementation"("org.ow2.asm:asm:9.2")
}

View File

@ -26,12 +26,8 @@ import java.util.Locale;
import com.dfsek.terra.api.block.entity.BlockEntity;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.handle.WorldHandle;
import com.dfsek.terra.api.util.generic.pair.Pair;
import com.dfsek.terra.api.util.vector.Vector3;
import com.dfsek.terra.bukkit.structure.WorldEditUtil;
import com.dfsek.terra.bukkit.world.BukkitAdapter;
import com.dfsek.terra.bukkit.world.block.data.BukkitBlockState;
import com.dfsek.terra.bukkit.world.entity.BukkitEntityType;
@ -64,10 +60,5 @@ public class BukkitWorldHandle implements WorldHandle {
if(!id.startsWith("minecraft:")) throw new LoadException("Invalid entity identifier " + id);
return new BukkitEntityType(org.bukkit.entity.EntityType.valueOf(id.toUpperCase(Locale.ROOT).substring(10)));
}
@Override
public Pair<Vector3, Vector3> getSelectedLocation(Player player) {
org.bukkit.Location[] locations = WorldEditUtil.getSelectionLocations(BukkitAdapter.adapt(player));
return Pair.of(BukkitAdapter.adapt(locations[0]), BukkitAdapter.adapt(locations[1]));
}
}

View File

@ -16,7 +16,7 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("org.yaml", "com.dfsek.terra.lib.yaml")
}
val minecraft = "1.18-pre5"
val minecraft = "1.18-pre1"
val yarn = "4"
val fabricLoader = "0.12.5"

View File

@ -22,8 +22,6 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.NopeDecoratorConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.FeatureConfig;
@ -35,8 +33,7 @@ import com.dfsek.terra.fabric.generation.TerraBiomeSource;
public class FabricEntryPoint implements ModInitializer {
public static final PopulatorFeature POPULATOR_FEATURE = new PopulatorFeature(DefaultFeatureConfig.CODEC);
public static final ConfiguredFeature<?, ?> POPULATOR_CONFIGURED_FEATURE = POPULATOR_FEATURE.configure(FeatureConfig.DEFAULT).decorate(
Decorator.NOPE.configure(NopeDecoratorConfig.INSTANCE));
public static final ConfiguredFeature<?, ?> POPULATOR_CONFIGURED_FEATURE = POPULATOR_FEATURE.configure(FeatureConfig.DEFAULT);
private static final PlatformImpl TERRA_PLUGIN = new PlatformImpl();
public static PlatformImpl getPlatform() {

View File

@ -17,9 +17,21 @@
package com.dfsek.terra.fabric.generation;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.world.World;
import com.dfsek.terra.api.world.generator.ChunkData;
import com.dfsek.terra.api.world.generator.ChunkGenerator;
import com.dfsek.terra.api.world.generator.Chunkified;
import com.dfsek.terra.api.world.generator.GeneratorWrapper;
import com.dfsek.terra.fabric.FabricEntryPoint;
import com.dfsek.terra.fabric.block.FabricBlockState;
import com.dfsek.terra.fabric.mixin.StructureAccessorAccessor;
import com.dfsek.terra.util.FastRandom;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.block.BlockState;
import net.minecraft.class_6748;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructureManager;
@ -34,29 +46,19 @@ import net.minecraft.world.SpawnHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler;
import net.minecraft.world.biome.source.util.MultiNoiseUtil.NoiseValuePoint;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.ChunkRandom;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.GenerationStep.Carver;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.chunk.VerticalBlockSample;
import net.minecraft.world.gen.feature.StructureFeature;
import net.minecraft.world.gen.feature.*;
import org.jetbrains.annotations.Nullable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.world.World;
import com.dfsek.terra.api.world.generator.ChunkData;
import com.dfsek.terra.api.world.generator.ChunkGenerator;
import com.dfsek.terra.api.world.generator.Chunkified;
import com.dfsek.terra.api.world.generator.GeneratorWrapper;
import com.dfsek.terra.fabric.FabricEntryPoint;
import com.dfsek.terra.fabric.block.FabricBlockState;
import com.dfsek.terra.fabric.mixin.StructureAccessorAccessor;
import com.dfsek.terra.util.FastRandom;
public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.ChunkGenerator implements GeneratorWrapper {
public static final Codec<ConfigPack> PACK_CODEC = RecordCodecBuilder.create(
@ -104,12 +106,17 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
}
@Override
public void carve(long seed, BiomeAccess access, Chunk chunk, GenerationStep.Carver carver) {
if(pack.vanillaCaves()) {
super.carve(seed, access, chunk, carver);
}
public MultiNoiseSampler getMultiNoiseSampler() {
return (x, y, z) -> new NoiseValuePoint(0, 0, 0, 0, 0, 0);
}
@Override
public void carve(ChunkRegion chunkRegion, long seed, BiomeAccess biomeAccess, StructureAccessor structureAccessor, Chunk chunk,
Carver generationStep) {
}
@Nullable
@Override
public BlockPos locateStructure(ServerWorld world, StructureFeature<?> feature, BlockPos center, int radius,
@ -138,8 +145,8 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
}
@Override
public void buildSurface(ChunkRegion region, Chunk chunk) {
// No-op
public void buildSurface(ChunkRegion region, StructureAccessor structures, Chunk chunk) {
// no op
}
@Override
@ -148,41 +155,49 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
int cx = region.getCenterPos().x;
int cy = region.getCenterPos().z;
Biome biome = region.getBiome((new ChunkPos(cx, cy)).getStartPos());
ChunkRandom chunkRandom = new ChunkRandom();
chunkRandom.setPopulationSeed(region.getSeed(), cx << 4, cy << 4);
SpawnHelper.populateEntities(region, biome, region.getCenterPos(), chunkRandom);
SpawnHelper.populateEntities(region, biome, region.getCenterPos(), region.getRandom());
}
}
@Override
public int getWorldHeight() {
return 256; //fixme
}
public Pool<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) {
if(accessor.getStructureAt(pos, true, StructureFeature.SWAMP_HUT).hasChildren()) {
if(!accessor.hasStructureReferences(pos)) {
return super.getEntitySpawnList(biome, accessor, group, pos);
} else {
if(accessor.method_38854(pos, StructureFeature.SWAMP_HUT).hasChildren()) {
if(group == SpawnGroup.MONSTER) {
return SwampHutFeature.MONSTER_SPAWNS;
}
if(group == SpawnGroup.CREATURE) {
return SwampHutFeature.CREATURE_SPAWNS;
}
}
if(group == SpawnGroup.MONSTER) {
return StructureFeature.SWAMP_HUT.getMonsterSpawns();
if(accessor.getStructureAt(pos, StructureFeature.PILLAGER_OUTPOST).hasChildren()) {
return PillagerOutpostFeature.MONSTER_SPAWNS;
}
if(accessor.getStructureAt(pos, StructureFeature.MONUMENT).hasChildren()) {
return OceanMonumentFeature.MONSTER_SPAWNS;
}
if(accessor.method_38854(pos, StructureFeature.FORTRESS).hasChildren()) {
return NetherFortressFeature.MONSTER_SPAWNS;
}
}
if(group == SpawnGroup.CREATURE) {
return StructureFeature.SWAMP_HUT.getCreatureSpawns();
}
return (group == SpawnGroup.UNDERGROUND_WATER_CREATURE || group == SpawnGroup.AXOLOTLS) && accessor.getStructureAt(pos,
StructureFeature.MONUMENT)
.hasChildren()
? SpawnSettings.EMPTY_ENTRY_POOL
: super.getEntitySpawnList(biome, accessor, group, pos);
}
if(group == SpawnGroup.MONSTER) {
if(accessor.getStructureAt(pos, false, StructureFeature.PILLAGER_OUTPOST).hasChildren()) {
return StructureFeature.PILLAGER_OUTPOST.getMonsterSpawns();
}
if(accessor.getStructureAt(pos, false, StructureFeature.MONUMENT).hasChildren()) {
return StructureFeature.MONUMENT.getMonsterSpawns();
}
if(accessor.getStructureAt(pos, true, StructureFeature.FORTRESS).hasChildren()) {
return StructureFeature.FORTRESS.getMonsterSpawns();
}
}
return group == SpawnGroup.UNDERGROUND_WATER_CREATURE && accessor.getStructureAt(pos, false, StructureFeature.MONUMENT)
.hasChildren()
? StructureFeature.MONUMENT.getUndergroundWaterCreatureSpawns()
: super.getEntitySpawnList(biome, accessor, group, pos);
}
@Override
@ -194,9 +209,9 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
}
@Override
public CompletableFuture<Chunk> populateNoise(Executor executor, StructureAccessor accessor, Chunk chunk) {
public CompletableFuture<Chunk> populateNoise(Executor executor, class_6748 arg, StructureAccessor structureAccessor, Chunk chunk) {
return CompletableFuture.supplyAsync(() -> {
World world = (World) ((StructureAccessorAccessor) accessor).getWorld();
World world = (World) ((StructureAccessorAccessor) structureAccessor).getWorld();
delegate.generateChunkData(world, new FastRandom(), chunk.getPos().x, chunk.getPos().z, (ChunkData) chunk);
delegate.getGenerationStages().forEach(populator -> {
if(populator instanceof Chunkified) {
@ -207,6 +222,16 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
}, executor);
}
@Override
public int getSeaLevel() {
return 0; //fixme
}
@Override
public int getMinimumY() {
return 0; //fixmw
}
@Override
public int getHeight(int x, int z, Heightmap.Type heightmap, HeightLimitView heightmapType) {
int height = ((World) world).getMaxHeight();

View File

@ -34,6 +34,8 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.fabric.FabricEntryPoint;
import com.dfsek.terra.fabric.util.FabricUtil;
import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler;
public class TerraBiomeSource extends BiomeSource {
public static final Codec<ConfigPack> PACK_CODEC = (RecordCodecBuilder.create(config -> config.group(
@ -79,7 +81,7 @@ public class TerraBiomeSource extends BiomeSource {
}
@Override
public Biome getBiomeForNoiseGen(int biomeX, int biomeY, int biomeZ) {
public Biome getBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseSampler noiseSampler) {
TerraBiome biome = pack.getBiomeProviderBuilder().getBiome(biomeX << 2, biomeZ << 2, seed);
return biomeRegistry.get(new Identifier("terra", FabricUtil.createBiomeID(pack, biome.getID())));
}

View File

@ -50,8 +50,7 @@ public class TerraGeneratorType extends GeneratorType {
}
@Override
protected ChunkGenerator getChunkGenerator(Registry<Biome> biomeRegistry,
Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry, long seed) {
return new FabricChunkGeneratorWrapper(new TerraBiomeSource(biomeRegistry, seed, pack), seed, pack);
protected ChunkGenerator getChunkGenerator(DynamicRegistryManager manager, long seed) {
return new FabricChunkGeneratorWrapper(new TerraBiomeSource(manager.get(Registry.BIOME_KEY), seed, pack), seed, pack);
}
}

View File

@ -28,13 +28,10 @@ import net.minecraft.util.registry.Registry;
import com.dfsek.terra.api.block.entity.BlockEntity;
import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.handle.WorldHandle;
import com.dfsek.terra.api.util.generic.pair.Pair;
import com.dfsek.terra.api.util.vector.Vector3;
import com.dfsek.terra.fabric.block.FabricBlockState;
import com.dfsek.terra.fabric.util.FabricAdapter;
import com.dfsek.terra.fabric.util.WorldEditUtil;
public class FabricWorldHandle implements WorldHandle {
@ -75,13 +72,4 @@ public class FabricWorldHandle implements WorldHandle {
return (EntityType) Registry.ENTITY_TYPE.get(identifier);
}
@Override
public Pair<Vector3, Vector3> getSelectedLocation(Player player) {
try {
Class.forName("com.sk89q.worldedit.WorldEdit");
} catch(ClassNotFoundException e) {
throw new IllegalStateException("WorldEdit is not installed.");
}
return WorldEditUtil.getSelection(player);
}
}

View File

@ -34,6 +34,6 @@ public interface GeneratorTypeAccessor {
}
@Mutable
@Accessor("translationKey")
void setTranslationKey(Text translationKey);
@Accessor("displayName")
void setDisplayName(Text translationKey);
}

View File

@ -19,14 +19,16 @@ package com.dfsek.terra.fabric.mixin.access;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.MobSpawnerEntry;
import net.minecraft.world.MobSpawnerLogic;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(MobSpawnerLogic.class)
public interface MobSpawnerLogicAccessor {
@Invoker("getEntityId")
Identifier callGetEntityId(World world, BlockPos blockPos);
@Accessor("spawnEntry")
MobSpawnerEntry getSpawnEntry();
}

View File

@ -21,6 +21,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.MobSpawnerBlockEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.MobSpawnerLogic;
@ -48,7 +49,8 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
public abstract MobSpawnerLogic getLogic();
public EntityType terra$getSpawnedType() {
return (EntityType) Registry.ENTITY_TYPE.get(((MobSpawnerLogicAccessor) getLogic()).callGetEntityId(world, pos));
return (EntityType) Registry.ENTITY_TYPE.get(
Identifier.tryParse(((MobSpawnerLogicAccessor) getLogic()).getSpawnEntry().getNbt().getString("id")));
}
public void terra$setSpawnedType(@NotNull EntityType creatureType) {

View File

@ -36,26 +36,27 @@ import com.dfsek.terra.fabric.block.FabricBlockState;
@Mixin(ChunkRegion.class)
@Implements(@Interface(iface = Chunk.class, prefix = "terraChunk$", remap = Interface.Remap.NONE))
public abstract class ChunkRegionMixin {
@Final
@Shadow
private ChunkPos centerPos;
@Final
private net.minecraft.world.chunk.Chunk centerPos;
public void terraChunk$setBlock(int x, int y, int z, @NotNull BlockState blockState, boolean physics) {
((ChunkRegion) (Object) this).setBlockState(new BlockPos(x + (centerPos.x << 4), y, z + (centerPos.z << 4)),
((ChunkRegion) (Object) this).setBlockState(new BlockPos(x + (centerPos.getPos().x << 4), y, z + (centerPos.getPos().z << 4)),
((FabricBlockState) blockState).getHandle(), 0);
}
public @NotNull BlockState terraChunk$getBlock(int x, int y, int z) {
return new FabricBlockState(
((ChunkRegion) (Object) this).getBlockState(new BlockPos(x + (centerPos.x << 4), y, z + (centerPos.z << 4))));
((ChunkRegion) (Object) this).getBlockState(new BlockPos(x + (centerPos.getPos().x << 4), y, z + (centerPos.getPos().z << 4))));
}
public int terraChunk$getX() {
return centerPos.x;
return centerPos.getPos().x;
}
public int terraChunk$getZ() {
return centerPos.z;
return centerPos.getPos().z;
}
public World terraChunk$getWorld() {

View File

@ -53,7 +53,7 @@ public abstract class WorldChunkMixin {
}
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
((net.minecraft.world.chunk.Chunk) this).setBlockState(new BlockPos(x, y, z), ((FabricBlockState) blockState).getHandle(), false);
((net.minecraft.world.chunk.Chunk) (Object) this).setBlockState(new BlockPos(x, y, z), ((FabricBlockState) blockState).getHandle(), false);
}
public @NotNull BlockState terra$getBlock(int x, int y, int z) {
@ -61,11 +61,11 @@ public abstract class WorldChunkMixin {
}
public int terra$getX() {
return ((net.minecraft.world.chunk.Chunk) this).getPos().x;
return ((net.minecraft.world.chunk.Chunk) (Object) this).getPos().x;
}
public int terra$getZ() {
return ((net.minecraft.world.chunk.Chunk) this).getPos().z;
return ((net.minecraft.world.chunk.Chunk) (Object) this).getPos().z;
}
public World terra$getWorld() {

View File

@ -38,7 +38,7 @@ public abstract class ProtoChunkMixin {
public abstract net.minecraft.block.BlockState getBlockState(BlockPos pos);
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
((net.minecraft.world.chunk.Chunk) this).setBlockState(new BlockPos(x, y, z), ((FabricBlockState) blockState).getHandle(), false);
((net.minecraft.world.chunk.Chunk) (Object) this).setBlockState(new BlockPos(x, y, z), ((FabricBlockState) blockState).getHandle(), false);
}
public @NotNull BlockState terra$getBlock(int x, int y, int z) {

View File

@ -46,7 +46,7 @@ public abstract class ItemStackMixin {
public abstract boolean isDamageable();
@Shadow
public abstract void setTag(@Nullable NbtCompound tag);
public abstract void setNbt(@Nullable NbtCompound tag);
public int terra$getAmount() {
return getCount();
@ -66,7 +66,7 @@ public abstract class ItemStackMixin {
@SuppressWarnings("ConstantConditions")
public void terra$setItemMeta(ItemMeta meta) {
setTag(((ItemStack) (Object) meta).getTag());
setNbt(((ItemStack) (Object) meta).getNbt());
}
@Intrinsic

View File

@ -23,9 +23,10 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ChunkRegion;
import net.minecraft.world.ServerWorldAccess;
import net.minecraft.world.TickScheduler;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.tick.OrderedTick;
import net.minecraft.world.tick.QueryableTickScheduler;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
@ -68,7 +69,7 @@ public abstract class ChunkRegionMixin {
private long seed;
@Shadow
public abstract TickScheduler<Fluid> getFluidTickScheduler();
public abstract QueryableTickScheduler<Fluid> getFluidTickScheduler();
@Inject(at = @At("RETURN"),
method = "<init>(Lnet/minecraft/server/world/ServerWorld;Ljava/util/List;Lnet/minecraft/world/chunk/ChunkStatus;I)V")
@ -91,8 +92,8 @@ public abstract class ChunkRegionMixin {
BlockPos pos = new BlockPos(x, y, z);
((ChunkRegion) (Object) this).setBlockState(pos, ((FabricBlockState) data).getHandle(), physics ? 3 : 1042);
if(physics && ((FabricBlockState) data).getHandle().getBlock() instanceof FluidBlock) {
getFluidTickScheduler().schedule(pos, ((FluidBlock) ((FabricBlockState) data).getHandle().getBlock()).getFluidState(
((FabricBlockState) data).getHandle()).getFluid(), 0);
getFluidTickScheduler().scheduleTick(OrderedTick.create(((FluidBlock) ((FabricBlockState) data).getHandle().getBlock()).getFluidState(
((FabricBlockState) data).getHandle()).getFluid(), pos));
}
}

View File

@ -45,7 +45,7 @@ public class MinecraftClientMixin {
FabricEntryPoint.getPlatform().getConfigRegistry().forEach(pack -> {
final GeneratorType generatorType = new TerraGeneratorType(pack);
//noinspection ConstantConditions
((GeneratorTypeAccessor) generatorType).setTranslationKey(new LiteralText("Terra:" + pack.getID()));
((GeneratorTypeAccessor) generatorType).setDisplayName(new LiteralText("Terra:" + pack.getID()));
GeneratorTypeAccessor.getValues().add(1, generatorType);
});
}

View File

@ -76,8 +76,8 @@ public abstract class GeneratorOptionsMixin {
Registry<DimensionType> dimensionTypes = registryManager.get(Registry.DIMENSION_TYPE_KEY);
Registry<Biome> biomeRegistry = registryManager.get(Registry.BIOME_KEY);
Registry<ChunkGeneratorSettings> chunkGeneratorSettings = registryManager.get(Registry.CHUNK_GENERATOR_SETTINGS_KEY);
SimpleRegistry<DimensionOptions> dimensionOptions = DimensionType.createDefaultDimensionOptions(dimensionTypes, biomeRegistry,
chunkGeneratorSettings, l);
SimpleRegistry<DimensionOptions> dimensionOptions = DimensionType.createDefaultDimensionOptions(registryManager,
l, false);
prop = prop.substring(prop.indexOf(":") + 1);

View File

@ -74,10 +74,8 @@ public final class FabricUtil {
GenerationSettings.Builder generationSettings = new GenerationSettings.Builder();
generationSettings.surfaceBuilder(
vanilla.getGenerationSettings().getSurfaceBuilder()); // It needs a surfacebuilder, even though we dont use it.
generationSettings.feature(GenerationStep.Feature.VEGETAL_DECORATION, FabricEntryPoint.POPULATOR_CONFIGURED_FEATURE);
generationSettings.feature(GenerationStep.Feature.VEGETAL_DECORATION, FabricEntryPoint.POPULATOR_CONFIGURED_FEATURE.method_39595());
if(pack.vanillaCaves()) {
for(GenerationStep.Carver carver : GenerationStep.Carver.values()) {
@ -144,8 +142,6 @@ public final class FabricUtil {
return new Biome.Builder()
.precipitation(vanilla.getPrecipitation())
.category(vanilla.getCategory())
.depth(vanilla.getDepth())
.scale(vanilla.getScale())
.temperature(vanilla.getTemperature())
.downfall(vanilla.getDownfall())
.effects(effects.build())

View File

@ -1,48 +0,0 @@
/*
* This file is part of Terra.
*
* Terra is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Terra is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Terra. If not, see <https://www.gnu.org/licenses/>.
*/
package com.dfsek.terra.fabric.util;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.world.World;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.util.generic.pair.Pair;
import com.dfsek.terra.api.util.vector.Vector3;
public final class WorldEditUtil {
public static Pair<Vector3, Vector3> getSelection(Player player) {
WorldEdit worldEdit = WorldEdit.getInstance();
try {
Region selection = worldEdit.getSessionManager()
.get(com.sk89q.worldedit.fabric.FabricAdapter.adaptPlayer((ServerPlayerEntity) player))
.getSelection(com.sk89q.worldedit.fabric.FabricAdapter.adapt((World) player.world()));
BlockVector3 min = selection.getMinimumPoint();
BlockVector3 max = selection.getMaximumPoint();
Vector3 l1 = new Vector3(min.getBlockX(), min.getBlockY(), min.getBlockZ());
Vector3 l2 = new Vector3(max.getBlockX(), max.getBlockY(), max.getBlockZ());
return Pair.of(l1, l2);
} catch(IncompleteRegionException e) {
throw new IllegalStateException("No selection has been made", e);
}
}
}

View File

@ -25,7 +25,7 @@
],
"depends": {
"fabricloader": ">=0.7.4",
"minecraft": "1.17.x"
"minecraft": "1.18.x"
},
"accessWidener": "terra.accesswidener"
}

View File

@ -1,9 +1,9 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.dfsek.terra.fabric.mixin",
"required": true,
"minVersion": "0.8",
"package": "com.dfsek.terra.fabric.mixin",
"compatibilityLevel": "JAVA_16",
"mixins": [
"mixins": [
"CommandManagerMixin",
"ServerWorldMixin",
"StructureAccessorAccessor",
@ -33,16 +33,16 @@
"implementations.world.ChunkRegionMixin",
"implementations.world.ServerWorldMixin"
],
"client": [
"client": [
"access.GeneratorTypeAccessor",
"lifecycle.client.MinecraftClientMixin"
],
"server": [
"server": [
"lifecycle.server.GeneratorOptionsMixin",
"lifecycle.server.ServerMainMixin"
],
"injectors": {
"injectors": {
"defaultRequire": 1
},
"refmap": "terra-refmap.json"
"refmap": "terra-refmap.json"
}