Update to 20w11a

Well, there is still some minor issues with new options object and compile fails for a mysterious nullable

Signed-off-by: liach <liach@users.noreply.github.com>
This commit is contained in:
liach 2020-03-17 00:02:20 -05:00
parent b6c1b94e9d
commit ec2f6a4409
23 changed files with 72 additions and 50 deletions

@ -1 +1 @@
Subproject commit 6e6959528b41fe1704eb1d301dbee923de6e4742 Subproject commit 8c38ce3e65e1c7af602bf42a4a5b52c2d1c5340e

View File

@ -12,7 +12,7 @@ apply plugin: "fabric-loom"
apply plugin: "maven-publish" apply plugin: "maven-publish"
apply plugin: "eclipse" apply plugin: "eclipse"
version = "${mc_version}-${mod_version}" version = "${fabric_mc_version}-${mod_version}"
archivesBaseName = "TerraForgedAPI-fabric" archivesBaseName = "TerraForgedAPI-fabric"
repositories { repositories {
@ -21,8 +21,8 @@ repositories {
} }
dependencies { dependencies {
minecraft "com.mojang:minecraft:${mc_version}" minecraft "com.mojang:minecraft:${fabric_mc_version}"
mappings "net.fabricmc:yarn:${mc_version}+build.${yarn_build}:v2" mappings "net.fabricmc:yarn:${fabric_mc_version}+build.${yarn_build}:v2"
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
compile project(":Noise2D") compile project(":Noise2D")

View File

@ -43,6 +43,6 @@ public class ChunkContext {
this.chunkZ = chunk.getPos().z; this.chunkZ = chunk.getPos().z;
this.blockX = chunkX << 4; this.blockX = chunkX << 4;
this.blockZ = chunkZ << 4; this.blockZ = chunkZ << 4;
this.random.setSeed(chunkX, chunkZ); this.random.setTerrainSeed(chunkX, chunkZ);
} }
} }

View File

@ -12,7 +12,7 @@ apply plugin: "fabric-loom"
apply plugin: "maven-publish" apply plugin: "maven-publish"
apply plugin: "eclipse" apply plugin: "eclipse"
version = "${mc_version}-${mod_version}${getClassifier()}" version = "${fabric_mc_version}-${mod_version}${getClassifier()}"
archivesBaseName = "TerraForged" archivesBaseName = "TerraForged"
repositories { repositories {
@ -21,8 +21,8 @@ repositories {
} }
dependencies { dependencies {
minecraft "com.mojang:minecraft:${mc_version}" minecraft "com.mojang:minecraft:${fabric_mc_version}"
mappings "net.fabricmc:yarn:${mc_version}+build.${yarn_build}:v2" mappings "net.fabricmc:yarn:${fabric_mc_version}+build.${yarn_build}:v2"
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
compile project(":Noise2D") compile project(":Noise2D")

View File

@ -31,6 +31,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder; import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
@ -40,7 +41,7 @@ public class ColdSteppe extends BiomeVariant {
public ColdSteppe() { public ColdSteppe() {
super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.GIANT_TREE_TAIGA, SurfaceBuilder.GRASS_CONFIG) super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.GIANT_TREE_TAIGA, SurfaceBuilder.GRASS_CONFIG)
.precipitation(Precipitation.SNOW).category(Biome.Category.TAIGA).depth(0.2F).scale(0.25F).temperature(0.2F).downfall(0.1F) .precipitation(Precipitation.SNOW).category(Biome.Category.TAIGA).depth(0.2F).scale(0.25F).temperature(0.2F).downfall(0.1F)
.waterColor(4159204).waterFogColor(329011).parent(null)); .effects(new BiomeEffects.Builder().waterColor(4159204).waterFogColor(329011).fogColor(12638463).build()).parent(null));
DefaultBiomeFeatures.addLandCarvers(this); DefaultBiomeFeatures.addLandCarvers(this);
DefaultBiomeFeatures.addDefaultStructures(this); DefaultBiomeFeatures.addDefaultStructures(this);
// DefaultBiomeFeatures.addLakes(this); // DefaultBiomeFeatures.addLakes(this);

View File

@ -29,6 +29,7 @@ import com.terraforged.api.biome.BiomeVariant;
import net.minecraft.entity.EntityCategory; import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.GenerationStep;
@ -42,7 +43,7 @@ public class Marshland extends BiomeVariant {
public Marshland() { public Marshland() {
super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.SWAMP, SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.RAIN) super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.SWAMP, SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.RAIN)
.category(Category.SWAMP).depth(0.2F).scale(0.2F).temperature(0.8F).downfall(0.4F).waterColor(6388580).waterFogColor(2302743) .category(Category.SWAMP).depth(0.2F).scale(0.2F).temperature(0.8F).downfall(0.4F).effects(new BiomeEffects.Builder().waterColor(6388580).waterFogColor(2302743).fogColor(12638463).build())
.parent(null)); .parent(null));
DefaultBiomeFeatures.addLandCarvers(this); DefaultBiomeFeatures.addLandCarvers(this);
DefaultBiomeFeatures.addDefaultStructures(this); DefaultBiomeFeatures.addDefaultStructures(this);

View File

@ -33,6 +33,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Heightmap; import net.minecraft.world.Heightmap;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
@ -46,8 +47,9 @@ public class SavannaScrub extends BiomeVariant {
public SavannaScrub() { public SavannaScrub() {
super((new Settings()).configureSurfaceBuilder(new Builder(), SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.NONE) super((new Settings()).configureSurfaceBuilder(new Builder(), SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.NONE)
.category(Biome.Category.SAVANNA).depth(0.125F).scale(0.05F).temperature(1.2F).downfall(0.0F).waterColor(4159204) .category(Biome.Category.SAVANNA).depth(0.125F).scale(0.05F).temperature(1.2F).downfall(0.0F)
.waterFogColor(329011).parent(null)); .effects(new BiomeEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).build())
.parent(null));
DefaultBiomeFeatures.addLandCarvers(this); DefaultBiomeFeatures.addLandCarvers(this);
DefaultBiomeFeatures.addDefaultStructures(this); DefaultBiomeFeatures.addDefaultStructures(this);
// DefaultBiomeFeatures.addLakes(this); // DefaultBiomeFeatures.addLakes(this);

View File

@ -32,6 +32,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Heightmap; import net.minecraft.world.Heightmap;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
@ -45,8 +46,9 @@ public class ShatteredSavannaScrub extends BiomeVariant {
public ShatteredSavannaScrub() { public ShatteredSavannaScrub() {
super((new Settings()).configureSurfaceBuilder(new Builder(), SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.NONE) super((new Settings()).configureSurfaceBuilder(new Builder(), SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.NONE)
.category(Biome.Category.SAVANNA).depth(0.3625F).scale(1.225F).temperature(1.1F).downfall(0.0F).waterColor(4159204) .category(Biome.Category.SAVANNA).depth(0.3625F).scale(1.225F).temperature(1.1F).downfall(0.0F)
.waterFogColor(329011).parent("terraforged:savanna_scrub")); .effects(new BiomeEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).build())
.parent("terraforged:savanna_scrub"));
DefaultBiomeFeatures.addLandCarvers(this); DefaultBiomeFeatures.addLandCarvers(this);
DefaultBiomeFeatures.addDefaultStructures(this); DefaultBiomeFeatures.addDefaultStructures(this);
// DefaultBiomeFeatures.addLakes(this); // DefaultBiomeFeatures.addLakes(this);

View File

@ -29,6 +29,7 @@ import com.terraforged.api.biome.BiomeVariant;
import net.minecraft.entity.EntityCategory; import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder; import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
@ -37,7 +38,8 @@ public class SnowyTaigaScrub extends BiomeVariant {
public SnowyTaigaScrub() { public SnowyTaigaScrub() {
super(new Settings().configureSurfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.SNOW) super(new Settings().configureSurfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.SNOW)
.category(Category.TAIGA).depth(0.2F).scale(0.2F).temperature(-0.5F).downfall(0.4F).waterColor(4020182).waterFogColor(329011) .category(Category.TAIGA).depth(0.2F).scale(0.2F).temperature(-0.5F).downfall(0.4F)
.effects(new BiomeEffects.Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).build())
.parent(null)); .parent(null));
DefaultBiomeFeatures.addLandCarvers(this); DefaultBiomeFeatures.addLandCarvers(this);
DefaultBiomeFeatures.addDefaultStructures(this); DefaultBiomeFeatures.addDefaultStructures(this);

View File

@ -31,6 +31,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder; import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
@ -39,7 +40,8 @@ public class Steppe extends BiomeVariant {
protected Steppe() { protected Steppe() {
super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.GIANT_TREE_TAIGA, SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.SNOW) super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.GIANT_TREE_TAIGA, SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.SNOW)
.category(Category.SAVANNA).depth(0.2F).scale(0.2F).temperature(0.7F).downfall(0.1F).waterColor(4159204).waterFogColor(329011) .category(Category.SAVANNA).depth(0.2F).scale(0.2F).temperature(0.7F).downfall(0.1F)
.effects(new BiomeEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).build())
.parent(null)); .parent(null));
DefaultBiomeFeatures.addLandCarvers(this); DefaultBiomeFeatures.addLandCarvers(this);
DefaultBiomeFeatures.addDefaultStructures(this); DefaultBiomeFeatures.addDefaultStructures(this);

View File

@ -29,6 +29,7 @@ import com.terraforged.api.biome.BiomeVariant;
import net.minecraft.entity.EntityCategory; import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder; import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
@ -37,7 +38,8 @@ public class TaigaScrub extends BiomeVariant {
public TaigaScrub() { public TaigaScrub() {
super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.RAIN) super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_CONFIG).precipitation(Precipitation.RAIN)
.category(Category.TAIGA).depth(0.2F).scale(0.2F).temperature(0.25F).downfall(0.8F).waterColor(4159204).waterFogColor(329011) .category(Category.TAIGA).depth(0.2F).scale(0.2F).temperature(0.25F).downfall(0.8F)
.effects(new BiomeEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).build())
.parent(null)); .parent(null));
DefaultBiomeFeatures.addLandCarvers(this); DefaultBiomeFeatures.addLandCarvers(this);
DefaultBiomeFeatures.addDefaultStructures(this); DefaultBiomeFeatures.addDefaultStructures(this);

View File

@ -29,6 +29,7 @@ import com.terraforged.api.biome.BiomeVariant;
import net.minecraft.entity.EntityCategory; import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.gen.feature.BuriedTreasureFeatureConfig; import net.minecraft.world.gen.feature.BuriedTreasureFeatureConfig;
@ -41,7 +42,8 @@ public class WarmBeach extends BiomeVariant {
public WarmBeach() { public WarmBeach() {
super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.SAND_CONFIG).precipitation(Precipitation.RAIN) super((new Settings()).configureSurfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.SAND_CONFIG).precipitation(Precipitation.RAIN)
.category(Category.BEACH).depth(-0.5F).scale(0.1F).temperature(1.5F).downfall(0.5F).waterColor(4445678).waterFogColor(270131) .category(Category.BEACH).depth(-0.5F).scale(0.1F).temperature(1.5F).downfall(0.5F)
.effects(new BiomeEffects.Builder().fogColor(12638463).waterColor(4445678).waterFogColor(270131).build())
.parent(null)); .parent(null));
this.addStructureFeature(Feature.MINESHAFT.configure(new MineshaftFeatureConfig(0.004D, MineshaftFeature.Type.NORMAL))); this.addStructureFeature(Feature.MINESHAFT.configure(new MineshaftFeatureConfig(0.004D, MineshaftFeature.Type.NORMAL)));
this.addStructureFeature(Feature.BURIED_TREASURE.configure(new BuriedTreasureFeatureConfig(0.01F))); this.addStructureFeature(Feature.BURIED_TREASURE.configure(new BuriedTreasureFeatureConfig(0.01F)));

View File

@ -53,7 +53,7 @@ public class GridBiomeMap extends AbstractBiomeMap {
public Biome getBiome(BiomeType type, float temperature, float moisture, float shape) { public Biome getBiome(BiomeType type, float temperature, float moisture, float shape) {
BiomeGroup group = biomeTypes[type.ordinal()]; BiomeGroup group = biomeTypes[type.ordinal()];
if (group == null) { if (group == null) {
return Biomes.NETHER; return Biomes.NETHER_WASTES;
} }
return group.biomes.get(moisture, temperature, shape); return group.biomes.get(moisture, temperature, shape);
} }

View File

@ -47,6 +47,7 @@ import net.minecraft.world.gen.chunk.ChunkGeneratorConfig;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
import java.util.List; import java.util.List;
import java.util.stream.IntStream;
public abstract class ObfHelperChunkGenerator<T extends ChunkGeneratorConfig> extends ChunkGenerator<T> { public abstract class ObfHelperChunkGenerator<T extends ChunkGeneratorConfig> extends ChunkGenerator<T> {
@ -59,7 +60,7 @@ public abstract class ObfHelperChunkGenerator<T extends ChunkGeneratorConfig> ex
public ObfHelperChunkGenerator(IWorld world, BiomeSource biomeSource, T settings) { public ObfHelperChunkGenerator(IWorld world, BiomeSource biomeSource, T settings) {
super(world, biomeSource, settings); super(world, biomeSource, settings);
ChunkRandom random = new ChunkRandom(world.getSeed()); ChunkRandom random = new ChunkRandom(world.getSeed());
this.surfaceNoise = new OctavePerlinNoiseSampler(random, 3, 0); this.surfaceNoise = new OctavePerlinNoiseSampler(random, IntStream.rangeClosed(-3, 0));
} }
@Override @Override
@ -98,7 +99,7 @@ public abstract class ObfHelperChunkGenerator<T extends ChunkGeneratorConfig> ex
int chunkZ = region.getCenterChunkZ(); int chunkZ = region.getCenterChunkZ();
Biome biome = region.getChunk(chunkX, chunkZ).getBiomeArray().getBiomeForNoiseGen(0, 0, 0); Biome biome = region.getChunk(chunkX, chunkZ).getBiomeArray().getBiomeForNoiseGen(0, 0, 0);
ChunkRandom random = new ChunkRandom(); ChunkRandom random = new ChunkRandom();
random.setSeed(region.getSeed(), chunkX << 4, chunkZ << 4); random.setPopulationSeed(region.getSeed(), chunkX << 4, chunkZ << 4);
SpawnHelper.populateEntities(region, biome, chunkX, chunkZ, random); SpawnHelper.populateEntities(region, biome, chunkX, chunkZ, random);
} }

View File

@ -124,7 +124,7 @@ public class TerraChunkGenerator extends ObfHelperChunkGenerator<ChunkGeneratorC
ChunkPos pos = chunk.getPos(); ChunkPos pos = chunk.getPos();
ChunkReader reader = getChunkReader(pos.x, pos.z); ChunkReader reader = getChunkReader(pos.x, pos.z);
TerraBiomeArray container = getBiomeSource().createBiomeContainer(reader); TerraBiomeArray container = getBiomeSource().createBiomeContainer(reader);
((ProtoChunk) chunk).method_22405(container); ((ProtoChunk) chunk).setBiomes(container);
// apply chunk-local heightmap modifications // apply chunk-local heightmap modifications
preProcess(pos, reader, container); preProcess(pos, reader, container);
} }
@ -205,7 +205,7 @@ public class TerraChunkGenerator extends ObfHelperChunkGenerator<ChunkGeneratorC
postProcess(container.getChunkReader(), container, context); postProcess(container.getChunkReader(), container, context);
// bake biome array & discard gen data // bake biome array & discard gen data
((ProtoChunk) chunk).method_22405(container.bakeBiomes()); ((ProtoChunk) chunk).setBiomes(container.bakeBiomes());
} }
@Override @Override
@ -292,7 +292,7 @@ public class TerraChunkGenerator extends ObfHelperChunkGenerator<ChunkGeneratorC
ChunkReader view = getChunkReader(chunk.getPos().x, chunk.getPos().z); ChunkReader view = getChunkReader(chunk.getPos().x, chunk.getPos().z);
TerraBiomeArray container = getBiomeSource().createBiomeContainer(view); TerraBiomeArray container = getBiomeSource().createBiomeContainer(view);
if (chunk instanceof ProtoChunk) { if (chunk instanceof ProtoChunk) {
((ProtoChunk) chunk).method_22405(container); ((ProtoChunk) chunk).setBiomes(container);
} }
return container; return container;

View File

@ -335,11 +335,6 @@ public class RegionDelegate extends ChunkRegion {
return region.getClosestPlayer(x, y, z, distance, creativePlayers); return region.getClosestPlayer(x, y, z, distance, creativePlayers);
} }
@Override
public PlayerEntity getClosestPlayer(double x, double y, double z) {
return region.getClosestPlayer(x, y, z);
}
@Override @Override
public boolean isPlayerInRange(double x, double y, double z, double distance) { public boolean isPlayerInRange(double x, double y, double z, double distance) {
return region.isPlayerInRange(x, y, z, distance); return region.isPlayerInRange(x, y, z, distance);

View File

@ -104,7 +104,7 @@ public class TerraCommand {
"This command can only be run in a TerraForged world!" "This command can only be run in a TerraForged world!"
)); ));
BlockPos pos = context.getSource().getPlayer().getBlockPos(); BlockPos pos = context.getSource().getPlayer().getSenseCenterPos();
BiomeProvider biomeProvider = getBiomeProvider(context); BiomeProvider biomeProvider = getBiomeProvider(context);
Cell<Terrain> cell = biomeProvider.lookupPos(pos.getX(), pos.getZ()); Cell<Terrain> cell = biomeProvider.lookupPos(pos.getX(), pos.getZ());
Biome biome = biomeProvider.getBiome(cell, pos.getX(), pos.getZ()); Biome biome = biomeProvider.getBiome(cell, pos.getX(), pos.getZ());
@ -127,7 +127,7 @@ public class TerraCommand {
private static int debugBiome(CommandContext<ServerCommandSource> context) throws CommandSyntaxException { private static int debugBiome(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
ServerPlayerEntity player = context.getSource().getPlayer(); ServerPlayerEntity player = context.getSource().getPlayer();
BlockPos position = player.getBlockPos(); BlockPos position = player.getSenseCenterPos();
int x = position.getX(); int x = position.getX();
int y = position.getY(); int y = position.getY();
int z = position.getZ(); int z = position.getZ();
@ -155,7 +155,7 @@ public class TerraCommand {
Terrain terrain = TerrainArgType.getTerrain(context, "terrain"); Terrain terrain = TerrainArgType.getTerrain(context, "terrain");
Terrain target = getTerrainInstance(terrain, terraContext.terrain); Terrain target = getTerrainInstance(terrain, terraContext.terrain);
BlockPos pos = context.getSource().getPlayer().getBlockPos(); BlockPos pos = context.getSource().getPlayer().getSenseCenterPos();
UUID playerID = context.getSource().getPlayer().getUuid(); UUID playerID = context.getSource().getPlayer().getUuid();
MinecraftServer server = context.getSource().getMinecraftServer(); MinecraftServer server = context.getSource().getMinecraftServer();
WorldGenerator worldGenerator = terraContext.factory.get(); WorldGenerator worldGenerator = terraContext.factory.get();
@ -174,7 +174,7 @@ public class TerraCommand {
)); ));
Biome biome = BiomeArgType.getBiome(context, "biome"); Biome biome = BiomeArgType.getBiome(context, "biome");
BlockPos pos = context.getSource().getPlayer().getBlockPos(); BlockPos pos = context.getSource().getPlayer().getSenseCenterPos();
UUID playerID = context.getSource().getPlayer().getUuid(); UUID playerID = context.getSource().getPlayer().getUuid();
MinecraftServer server = context.getSource().getMinecraftServer(); MinecraftServer server = context.getSource().getMinecraftServer();
ServerWorld reader = context.getSource().getPlayer().getServerWorld(); ServerWorld reader = context.getSource().getPlayer().getServerWorld();
@ -195,7 +195,7 @@ public class TerraCommand {
Terrain terrain = TerrainArgType.getTerrain(context, "terrain"); Terrain terrain = TerrainArgType.getTerrain(context, "terrain");
Terrain target = getTerrainInstance(terrain, terraContext.terrain); Terrain target = getTerrainInstance(terrain, terraContext.terrain);
Biome biome = BiomeArgType.getBiome(context, "biome"); Biome biome = BiomeArgType.getBiome(context, "biome");
BlockPos pos = context.getSource().getPlayer().getBlockPos(); BlockPos pos = context.getSource().getPlayer().getSenseCenterPos();
ServerWorld world = context.getSource().getPlayer().getServerWorld(); ServerWorld world = context.getSource().getPlayer().getServerWorld();
UUID playerID = context.getSource().getPlayer().getUuid(); UUID playerID = context.getSource().getPlayer().getUuid();
MinecraftServer server = context.getSource().getMinecraftServer(); MinecraftServer server = context.getSource().getMinecraftServer();

View File

@ -76,7 +76,7 @@ public class TerrainHelper {
StructureStart structurestart = neighbourChunk.getStructureStart(name); StructureStart structurestart = neighbourChunk.getStructureStart(name);
if (structurestart != null && structurestart.isInExistingChunk()) { if (structurestart != null && structurestart.isInExistingChunk()) {
for (StructurePiece structurepiece : structurestart.getChildren()) { for (StructurePiece structurepiece : structurestart.getChildren()) {
if (structurepiece.method_16654(pos, 12) && structurepiece instanceof PoolStructurePiece) { if (structurepiece.intersectsChunk(pos, 12) && structurepiece instanceof PoolStructurePiece) {
PoolStructurePiece piece = (PoolStructurePiece) structurepiece; PoolStructurePiece piece = (PoolStructurePiece) structurepiece;
StructurePool.Projection placement = piece.getPoolElement().getProjection(); StructurePool.Projection placement = piece.getPoolElement().getProjection();
if (placement == StructurePool.Projection.RIGID) { if (placement == StructurePool.Projection.RIGID) {

View File

@ -38,8 +38,8 @@ public class OverlayScreen extends Screen implements OverlayRenderer {
public OverlayScreen() { public OverlayScreen() {
super(new TranslatableText("")); super(new TranslatableText(""));
super.minecraft = MinecraftClient.getInstance(); super.client = MinecraftClient.getInstance();
super.font = minecraft.textRenderer; super.textRenderer = client.textRenderer;
} }
@Override @Override

View File

@ -71,7 +71,7 @@ public class ScrollPane extends ElementListWidget<ScrollPane.Entry> implements O
} }
@Override @Override
protected int getScrollbarPosition() { protected int getScrollbarPositionX() {
return getMaxPosition(); // todo old getRight return getMaxPosition(); // todo old getRight
} }

View File

@ -27,6 +27,7 @@ package com.terraforged.mod.gui;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.mojang.datafixers.Dynamic;
import com.terraforged.core.settings.Settings; import com.terraforged.core.settings.Settings;
import com.terraforged.mod.gui.element.TerraLabel; import com.terraforged.mod.gui.element.TerraLabel;
import com.terraforged.mod.gui.page.FeaturePage; import com.terraforged.mod.gui.page.FeaturePage;
@ -44,8 +45,10 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.world.CreateWorldScreen; import net.minecraft.client.gui.screen.world.CreateWorldScreen;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.datafixer.NbtOps;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import net.minecraft.world.level.LevelGeneratorOptions;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
@ -66,7 +69,8 @@ public class SettingsScreen extends OverlayScreen {
private int pageIndex = 0; private int pageIndex = 0;
public SettingsScreen(CreateWorldScreen parent) { public SettingsScreen(CreateWorldScreen parent) {
NBTHelper.deserialize(parent.generatorOptionsTag, settings); // todo enhance this!
NBTHelper.deserialize((CompoundTag) parent.generatorOptions.getDynamic().convert(NbtOps.INSTANCE).getValue(), settings);
this.parent = parent; this.parent = parent;
this.pages = new Page[]{ this.pages = new Page[]{
new GeneratorPage(settings, preview), new GeneratorPage(settings, preview),
@ -114,7 +118,8 @@ public class SettingsScreen extends OverlayScreen {
for (Page page : pages) { for (Page page : pages) {
page.save(); page.save();
} }
parent.generatorOptionsTag = NBTHelper.serializeCompact(settings); LevelGeneratorOptions oldOptions = parent.generatorOptions;
parent.generatorOptions = new LevelGeneratorOptions(oldOptions.getType(), new Dynamic<>(NbtOps.INSTANCE, NBTHelper.serializeCompact(settings)), oldOptions::createChunkGenerator);
onClose(); onClose();
})); }));

View File

@ -1,16 +1,21 @@
package com.terraforged.mod.settings; package com.terraforged.mod.settings;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.mojang.datafixers.OptionalDynamic;
import com.terraforged.mod.Log; import com.terraforged.mod.Log;
import com.terraforged.mod.util.nbt.NBTHelper; import com.terraforged.mod.util.nbt.NBTHelper;
import net.minecraft.datafixer.NbtOps;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.level.LevelGeneratorOptions;
import net.minecraft.world.level.LevelProperties; import net.minecraft.world.level.LevelProperties;
import org.spongepowered.asm.mixin.injection.struct.InjectorGroupInfo;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.Reader; import java.io.Reader;
import java.util.Map;
public class SettingsHelper { public class SettingsHelper {
@ -22,20 +27,20 @@ public class SettingsHelper {
} }
public static int getVersion(LevelProperties info) { public static int getVersion(LevelProperties info) {
if (info.getGeneratorOptions().isEmpty()) { if (info.getGeneratorOptions().getDynamic().getMapValues().map(Map::isEmpty).orElse(true)) {
// if options have not been set then the world has been created // if options have not been set then the world has been created
// during the current runtime .: is not legacy // during the current runtime .: is not legacy
// return TerraWorld.VERSION; todo // return TerraWorld.VERSION; todo
return 0; return 0;
} }
CompoundTag version = info.getGeneratorOptions().getCompound("version"); OptionalDynamic<?> version = info.getGeneratorOptions().getDynamic().get("version");
if (version.isEmpty()) { if (!version.get().isPresent()) {
// version tag is absent in legacy worlds .: is legacy // version tag is absent in legacy worlds .: is legacy
return 0; return 0;
} }
return version.getInt("value"); return version.get().get().get("value").asInt(0); // blursed dfu
} }
public static TerraSettings getSettings(IWorld world) { public static TerraSettings getSettings(IWorld world) {
@ -52,8 +57,8 @@ public class SettingsHelper {
public static TerraSettings getSettings(LevelProperties info) { public static TerraSettings getSettings(LevelProperties info) {
TerraSettings settings = new TerraSettings(); TerraSettings settings = new TerraSettings();
if (!info.getGeneratorOptions().isEmpty()) { if (!info.getGeneratorOptions().getDynamic().getMapValues().map(Map::isEmpty).orElse(true)) {
NBTHelper.deserialize(info.getGeneratorOptions(), settings); NBTHelper.deserialize((CompoundTag) info.getGeneratorOptions().getDynamic().convert(NbtOps.INSTANCE).getValue(), settings);
} }
return settings; return settings;
} }
@ -62,6 +67,7 @@ public class SettingsHelper {
settings.version = version; settings.version = version;
settings.generator.seed = info.getSeed(); settings.generator.seed = info.getSeed();
CompoundTag options = NBTHelper.serialize(settings); CompoundTag options = NBTHelper.serialize(settings);
info.setGeneratorOptions(options); // todo find generator type and chunk generator factory
//info.setGeneratorOptions(new LevelGeneratorOptions());
} }
} }

View File

@ -3,8 +3,9 @@ mc_version=1.15.2
forge_version=31.1.1 forge_version=31.1.1
mcp_channel=snapshot mcp_channel=snapshot
mcp_version=20200225-1.15.1 mcp_version=20200225-1.15.1
yarn_build=14 fabric_mc_version=20w11a
yarn_build=6
fabric_loader_version=0.7.8+build.187 fabric_loader_version=0.7.8+build.187
fabric_api_version=0.5.0+build.293-1.15 fabric_api_version=0.5.3+build.308-1.16
org.gradle.jvmargs=-Xmx4G org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false org.gradle.daemon=false