From dc3d5c47696c9e44eeba3cf888843e7f4a641951 Mon Sep 17 00:00:00 2001
From: modmuss50 <modmuss50@gmail.com>
Date: Thu, 23 Sep 2021 18:30:50 +0100
Subject: [PATCH] 21w38a

---
 build.gradle                                  |  6 +--
 fabric-biome-api-v1/build.gradle              |  2 +-
 .../fabric/api/biome/v1/NetherBiomes.java     | 12 ++---
 .../BiomeSelectionContextImpl.java            |  2 +-
 .../BiomeStructureStartsImpl.java             |  4 +-
 .../mixin/biome/MixinTheEndBiomeSource.java   |  2 +-
 .../fabric-biome-api-v1.accesswidener         |  4 +-
 fabric-events-interaction-v0/build.gradle     |  2 +-
 .../MixinServerPlayerInteractionManager.java  |  2 +-
 fabric-renderer-api-v1/build.gradle           |  2 +-
 .../renderer/simple/FrameBlockEntity.java     |  4 +-
 fabric-structure-api-v1/build.gradle          |  2 +-
 .../fabric/test/structure/StructureTest.java  | 46 ++++++-------------
 .../structure/mixin/ChunkSerializerMixin.java |  4 +-
 .../MixinConfiguredStructureFeatures.java     |  2 +-
 15 files changed, 38 insertions(+), 58 deletions(-)

diff --git a/build.gradle b/build.gradle
index f6ef311b4..85d94cee9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,9 +19,9 @@ plugins {
 def ENV = System.getenv()
 
 class Globals {
-	static def baseVersion = "0.40.3"
-	static def mcVersion = "21w37a"
-	static def yarnVersion = "+build.10"
+	static def baseVersion = "0.40.4"
+	static def mcVersion = "21w38a"
+	static def yarnVersion = "+build.1"
 	static def loaderVersion = "0.11.7"
 	static def preRelease = true
 }
diff --git a/fabric-biome-api-v1/build.gradle b/fabric-biome-api-v1/build.gradle
index 4505dea7c..08ed48b92 100644
--- a/fabric-biome-api-v1/build.gradle
+++ b/fabric-biome-api-v1/build.gradle
@@ -1,5 +1,5 @@
 archivesBaseName = "fabric-biome-api-v1"
-version = getSubprojectVersion(project, "4.0.0")
+version = getSubprojectVersion(project, "4.0.1")
 
 loom {
     accessWidenerPath = file("src/main/resources/fabric-biome-api-v1.accesswidener")
diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java
index 1c70f6832..815a84408 100644
--- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java
+++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java
@@ -41,12 +41,12 @@ public final class NetherBiomes {
 	 */
 	public static void addNetherBiome(RegistryKey<Biome> biome, MultiNoiseUtil.NoiseValuePoint mixedNoisePoint) {
 		NetherBiomeData.addNetherBiome(biome, MultiNoiseUtil.createNoiseHypercube(
-				mixedNoisePoint.getTemperatureNoise(),
-				mixedNoisePoint.getHumidityNoise(),
-				mixedNoisePoint.getContinentalnessNoise(),
-				mixedNoisePoint.getErosionNoise(),
-				mixedNoisePoint.getDepth(),
-				mixedNoisePoint.getWeirdnessNoise(),
+				mixedNoisePoint.temperatureNoise(),
+				mixedNoisePoint.humidityNoise(),
+				mixedNoisePoint.continentalnessNoise(),
+				mixedNoisePoint.erosionNoise(),
+				mixedNoisePoint.depth(),
+				mixedNoisePoint.weirdnessNoise(),
 				0
 		));
 	}
diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification/BiomeSelectionContextImpl.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification/BiomeSelectionContextImpl.java
index 5cfe537c6..7ee1e3f28 100644
--- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification/BiomeSelectionContextImpl.java
+++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification/BiomeSelectionContextImpl.java
@@ -83,7 +83,7 @@ public class BiomeSelectionContextImpl implements BiomeSelectionContext {
 		for (Map.Entry<RegistryKey<ChunkGeneratorSettings>, ChunkGeneratorSettings> entry : chunkGeneratorSettings.getEntries()) {
 			StructuresConfig structuresConfig = entry.getValue().getStructuresConfig();
 
-			if (structuresConfig.method_38424(instance.feature).get(instance).contains(getBiomeKey())) {
+			if (structuresConfig.getConfiguredStructureFeature(instance.feature).get(instance).contains(getBiomeKey())) {
 				return true;
 			}
 		}
diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification/BiomeStructureStartsImpl.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification/BiomeStructureStartsImpl.java
index 169b99815..32a173062 100644
--- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification/BiomeStructureStartsImpl.java
+++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification/BiomeStructureStartsImpl.java
@@ -133,7 +133,7 @@ public final class BiomeStructureStartsImpl {
 	}
 
 	private static Map<StructureFeature<?>, Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> unfreeze(ChunkGeneratorSettings settings) {
-		ImmutableMap<StructureFeature<?>, ImmutableMultimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> frozenMap = settings.getStructuresConfig().field_34696;
+		ImmutableMap<StructureFeature<?>, ImmutableMultimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> frozenMap = settings.getStructuresConfig().configuredStructures;
 		Map<StructureFeature<?>, Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> result = new HashMap<>(frozenMap.size());
 
 		for (Map.Entry<StructureFeature<?>, ImmutableMultimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> entry : frozenMap.entrySet()) {
@@ -144,7 +144,7 @@ public final class BiomeStructureStartsImpl {
 	}
 
 	private static void freeze(ChunkGeneratorSettings settings, Map<StructureFeature<?>, Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> structureStarts) {
-		settings.getStructuresConfig().field_34696 = structureStarts.entrySet().stream()
+		settings.getStructuresConfig().configuredStructures = structureStarts.entrySet().stream()
 				.collect(ImmutableMap.toImmutableMap(
 						Map.Entry::getKey,
 						e -> ImmutableMultimap.copyOf(e.getValue())
diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/MixinTheEndBiomeSource.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/MixinTheEndBiomeSource.java
index e9b546175..8e8dd0588 100644
--- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/MixinTheEndBiomeSource.java
+++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/MixinTheEndBiomeSource.java
@@ -30,7 +30,7 @@ import net.minecraft.util.registry.RegistryKey;
 import net.minecraft.world.biome.Biome;
 import net.minecraft.world.biome.source.TheEndBiomeSource;
 import net.minecraft.world.biome.source.util.MultiNoiseUtil;
-import net.minecraft.world.gen.ChunkRandom;
+import net.minecraft.world.gen.random.ChunkRandom;
 
 import net.fabricmc.fabric.impl.biome.TheEndBiomeData;
 
diff --git a/fabric-biome-api-v1/src/main/resources/fabric-biome-api-v1.accesswidener b/fabric-biome-api-v1/src/main/resources/fabric-biome-api-v1.accesswidener
index 8fd79cbd1..e9c4c9caa 100644
--- a/fabric-biome-api-v1/src/main/resources/fabric-biome-api-v1.accesswidener
+++ b/fabric-biome-api-v1/src/main/resources/fabric-biome-api-v1.accesswidener
@@ -1,4 +1,4 @@
 accessWidener	v1	named
 accessible  class   net/minecraft/world/biome/Biome$Weather
-accessible field net/minecraft/world/gen/chunk/StructuresConfig field_34696 Lcom/google/common/collect/ImmutableMap;
-mutable field net/minecraft/world/gen/chunk/StructuresConfig field_34696 Lcom/google/common/collect/ImmutableMap;
+accessible field net/minecraft/world/gen/chunk/StructuresConfig configuredStructures Lcom/google/common/collect/ImmutableMap;
+mutable field net/minecraft/world/gen/chunk/StructuresConfig configuredStructures Lcom/google/common/collect/ImmutableMap;
diff --git a/fabric-events-interaction-v0/build.gradle b/fabric-events-interaction-v0/build.gradle
index 788732d33..61a128ee9 100644
--- a/fabric-events-interaction-v0/build.gradle
+++ b/fabric-events-interaction-v0/build.gradle
@@ -1,5 +1,5 @@
 archivesBaseName = "fabric-events-interaction-v0"
-version = getSubprojectVersion(project, "0.4.11")
+version = getSubprojectVersion(project, "0.4.12")
 
 moduleDependencies(project, [
 		'fabric-api-base'
diff --git a/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerInteractionManager.java b/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerInteractionManager.java
index a6af35dfb..49fecfa0d 100644
--- a/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerInteractionManager.java
+++ b/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerInteractionManager.java
@@ -68,7 +68,7 @@ public class MixinServerPlayerInteractionManager {
 				BlockEntity blockEntity = world.getBlockEntity(pos);
 
 				if (blockEntity != null) {
-					Packet<ClientPlayPacketListener> updatePacket = blockEntity.method_38235();
+					Packet<ClientPlayPacketListener> updatePacket = blockEntity.toUpdatePacket();
 
 					if (updatePacket != null) {
 						this.player.networkHandler.sendPacket(updatePacket);
diff --git a/fabric-renderer-api-v1/build.gradle b/fabric-renderer-api-v1/build.gradle
index 89431da45..d72ce83ef 100644
--- a/fabric-renderer-api-v1/build.gradle
+++ b/fabric-renderer-api-v1/build.gradle
@@ -1,5 +1,5 @@
 archivesBaseName = "fabric-renderer-api-v1"
-version = getSubprojectVersion(project, "0.4.5")
+version = getSubprojectVersion(project, "0.4.6")
 
 moduleDependencies(project, [
 		'fabric-api-base'
diff --git a/fabric-renderer-api-v1/src/testmod/java/net/fabricmc/fabric/test/renderer/simple/FrameBlockEntity.java b/fabric-renderer-api-v1/src/testmod/java/net/fabricmc/fabric/test/renderer/simple/FrameBlockEntity.java
index 2f32c888a..ea076923c 100644
--- a/fabric-renderer-api-v1/src/testmod/java/net/fabricmc/fabric/test/renderer/simple/FrameBlockEntity.java
+++ b/fabric-renderer-api-v1/src/testmod/java/net/fabricmc/fabric/test/renderer/simple/FrameBlockEntity.java
@@ -88,8 +88,8 @@ public final class FrameBlockEntity extends BlockEntity implements RenderAttachm
 	}
 
 	@Override
-	public BlockEntityUpdateS2CPacket method_38235() {
-		return BlockEntityUpdateS2CPacket.method_38585(this);
+	public BlockEntityUpdateS2CPacket toUpdatePacket() {
+		return BlockEntityUpdateS2CPacket.create(this);
 	}
 
 	@Override
diff --git a/fabric-structure-api-v1/build.gradle b/fabric-structure-api-v1/build.gradle
index 92b54ffdb..784637206 100644
--- a/fabric-structure-api-v1/build.gradle
+++ b/fabric-structure-api-v1/build.gradle
@@ -1,5 +1,5 @@
 archivesBaseName = "fabric-structure-api-v1"
-version = getSubprojectVersion(project, "2.0.0")
+version = getSubprojectVersion(project, "2.0.1")
 moduleDependencies(project, [
 		'fabric-lifecycle-events-v1',
 		'fabric-api-base'
diff --git a/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/StructureTest.java b/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/StructureTest.java
index 695570a5b..653eade03 100644
--- a/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/StructureTest.java
+++ b/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/StructureTest.java
@@ -17,7 +17,6 @@
 package net.fabricmc.fabric.test.structure;
 
 import java.util.Random;
-import java.util.function.Predicate;
 
 import com.mojang.serialization.Codec;
 import org.apache.logging.log4j.LogManager;
@@ -25,27 +24,23 @@ import org.apache.logging.log4j.Logger;
 
 import net.minecraft.block.Blocks;
 import net.minecraft.nbt.NbtCompound;
-import net.minecraft.structure.StructureManager;
 import net.minecraft.structure.StructurePieceType;
 import net.minecraft.structure.ShiftableStructurePiece;
-import net.minecraft.structure.StructureStart;
-import net.minecraft.server.world.ServerWorld;
 import net.minecraft.util.Identifier;
 import net.minecraft.util.math.BlockBox;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.util.math.ChunkPos;
-import net.minecraft.util.registry.DynamicRegistryManager;
 import net.minecraft.util.registry.Registry;
 import net.minecraft.world.Heightmap;
-import net.minecraft.world.HeightLimitView;
 import net.minecraft.world.StructureWorldAccess;
-import net.minecraft.world.biome.Biome;
 import net.minecraft.world.gen.GenerationStep;
 import net.minecraft.world.gen.StructureAccessor;
 import net.minecraft.world.gen.chunk.ChunkGenerator;
 import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
 import net.minecraft.world.gen.feature.DefaultFeatureConfig;
 import net.minecraft.world.gen.feature.StructureFeature;
+import net.minecraft.class_6622;
+import net.minecraft.class_6626;
 
 import net.fabricmc.fabric.api.structure.v1.FabricStructureBuilder;
 
@@ -54,7 +49,7 @@ public class StructureTest {
 
 	public static final StructureFeature<DefaultFeatureConfig> STRUCTURE = new TestStructureFeature(DefaultFeatureConfig.CODEC);
 	public static final ConfiguredStructureFeature<DefaultFeatureConfig, ? extends StructureFeature<DefaultFeatureConfig>> CONFIGURED_STRUCTURE = STRUCTURE.configure(new DefaultFeatureConfig());
-	public static final StructurePieceType PIECE = TestStructureGenerator::new;
+	public static final StructurePieceType.class_6615 PIECE = TestStructureGenerator::new;
 
 	static {
 		LOGGER.info("Registering test structure");
@@ -69,29 +64,16 @@ public class StructureTest {
 
 	public static class TestStructureFeature extends StructureFeature<DefaultFeatureConfig> {
 		public TestStructureFeature(Codec<DefaultFeatureConfig> codec) {
-			super(codec);
+			super(codec, TestStructureFeature::generate);
 		}
 
-		@Override
-		public StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
-			return Start::new;
-		}
+		private static void generate(class_6626 arg, DefaultFeatureConfig defaultFeatureConfig, class_6622.class_6623 arg2) {
+			int blockX = arg2.comp_127().getStartX();
+			int blockZ = arg2.comp_127().getStartZ();
+			int blockY = arg2.comp_125().getHeight(blockX, blockZ, Heightmap.Type.WORLD_SURFACE_WG, arg2.comp_129());
 
-		public static class Start extends StructureStart<DefaultFeatureConfig> {
-			public Start(StructureFeature<DefaultFeatureConfig> feature, ChunkPos pos, int i, long l) {
-				super(feature, pos, i, l);
-			}
-
-			@Override
-			public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator, StructureManager manager, ChunkPos chunkPos, DefaultFeatureConfig featureConfig, HeightLimitView heightLimitView, Predicate<Biome> predicate) {
-				int blockX = chunkPos.getStartX();
-				int blockZ = chunkPos.getStartZ();
-				int blockY = chunkGenerator.getHeight(blockX, blockZ, Heightmap.Type.WORLD_SURFACE_WG, heightLimitView);
-
-				TestStructureGenerator generator = new TestStructureGenerator(random, blockX, blockY, blockZ);
-				this.children.add(generator);
-				setBoundingBoxFromChildren();
-			}
+			TestStructureGenerator generator = new TestStructureGenerator(arg2.comp_130(), blockX, blockY, blockZ);
+			arg.addPiece(generator);
 		}
 	}
 
@@ -100,12 +82,12 @@ public class StructureTest {
 			super(PIECE, x, y, z, 0, 48, 16, getRandomHorizontalDirection(random));
 		}
 
-		protected TestStructureGenerator(ServerWorld serverWorld, NbtCompound compoundTag) {
-			super(PIECE, compoundTag);
+		public TestStructureGenerator(NbtCompound nbtCompound) {
+			super(PIECE, nbtCompound);
 		}
 
 		@Override
-		public boolean generate(StructureWorldAccess structureWorldAccess, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) {
+		public void generate(StructureWorldAccess structureWorldAccess, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) {
 			for (int x = 0; x < 48; x++) {
 				for (int z = 0; z < 48; z++) {
 					for (int y = 0; y < 16; y++) {
@@ -113,8 +95,6 @@ public class StructureTest {
 					}
 				}
 			}
-
-			return true;
 		}
 	}
 }
diff --git a/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/mixin/ChunkSerializerMixin.java b/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/mixin/ChunkSerializerMixin.java
index f2ddd8eee..f1117631a 100644
--- a/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/mixin/ChunkSerializerMixin.java
+++ b/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/mixin/ChunkSerializerMixin.java
@@ -21,7 +21,7 @@ import org.spongepowered.asm.mixin.injection.Constant;
 import org.spongepowered.asm.mixin.injection.ModifyConstant;
 
 import net.minecraft.nbt.NbtCompound;
-import net.minecraft.server.world.ServerWorld;
+import net.minecraft.class_6625;
 import net.minecraft.world.ChunkSerializer;
 
 @Mixin(ChunkSerializer.class)
@@ -30,7 +30,7 @@ abstract class ChunkSerializerMixin {
 	 * @reason Changes the logging message for the `unknown structure start` to describe which chunk the missing structure is located in for debugging purposes.
 	 */
 	@ModifyConstant(method = "readStructureStarts", constant = @Constant(stringValue = "Unknown structure start: {}"))
-	private static String modifyErrorMessage(String original, ServerWorld serverWorld, NbtCompound tag, long worldSeed) {
+	private static String modifyErrorMessage(String original, class_6625 class_6625, NbtCompound tag, long worldSeed) {
 		// Use coordinates in tag to determine the position of the chunk
 		final int xPos = tag.getInt("xPos");
 		final int zPos = tag.getInt("zPos");
diff --git a/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/mixin/MixinConfiguredStructureFeatures.java b/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/mixin/MixinConfiguredStructureFeatures.java
index 54a7b8f6b..174151355 100644
--- a/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/mixin/MixinConfiguredStructureFeatures.java
+++ b/fabric-structure-api-v1/src/testmod/java/net/fabricmc/fabric/test/structure/mixin/MixinConfiguredStructureFeatures.java
@@ -33,7 +33,7 @@ import net.fabricmc.fabric.test.structure.StructureTest;
 
 @Mixin(ConfiguredStructureFeatures.class)
 public class MixinConfiguredStructureFeatures {
-	@Inject(method = "method_38570", at = @At("TAIL"))
+	@Inject(method = "registerAll", at = @At("TAIL"))
 	private static void addStructuresToBiomes(BiConsumer<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>> consumer, CallbackInfo ci) {
 		consumer.accept(StructureTest.CONFIGURED_STRUCTURE, BiomeKeys.PLAINS);
 	}