Skip to content

Commit

Permalink
Update mod to Minecraft 1.21.2 pre-release 1 (#4148)
Browse files Browse the repository at this point in the history
* Update mod to Minecraft 1.21.2 pre-release 1

* Bump version

---------

Co-authored-by: modmuss50 <[email protected]>
  • Loading branch information
haykam821 and modmuss50 authored Oct 8, 2024
1 parent 86ae0e5 commit 5763228
Show file tree
Hide file tree
Showing 22 changed files with 147 additions and 180 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

import java.util.concurrent.CompletableFuture;

import net.minecraft.class_10351;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BiomeTags;
import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.WinterDropBuiltinBiomes;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
Expand Down Expand Up @@ -97,7 +97,7 @@ private void generateCategoryTags() {
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DARK_FOREST)
.add(BiomeKeys.DARK_FOREST)
.addOptional(class_10351.PALE_GARDEN);
.addOptional(WinterDropBuiltinBiomes.PALE_GARDEN);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_OCEAN)
.addOptionalTag(BiomeTags.IS_OCEAN)
.addOptionalTag(ConventionalBiomeTags.IS_DEEP_OCEAN)
Expand Down Expand Up @@ -179,7 +179,7 @@ private void generateClimateAndVegetationTags() {
.add(BiomeKeys.SWAMP)
.add(BiomeKeys.STONY_SHORE)
.add(BiomeKeys.DARK_FOREST)
.addOptional(class_10351.PALE_GARDEN)
.addOptional(WinterDropBuiltinBiomes.PALE_GARDEN)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST)
Expand Down Expand Up @@ -252,7 +252,7 @@ private void generateClimateAndVegetationTags() {

getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_DENSE_OVERWORLD)
.add(BiomeKeys.DARK_FOREST)
.addOptional(class_10351.PALE_GARDEN)
.addOptional(WinterDropBuiltinBiomes.PALE_GARDEN)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA)
.add(BiomeKeys.JUNGLE)
Expand Down Expand Up @@ -285,7 +285,7 @@ private void generateClimateAndVegetationTags() {
.add(BiomeKeys.FLOWER_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.DARK_FOREST)
.addOptional(class_10351.PALE_GARDEN)
.addOptional(WinterDropBuiltinBiomes.PALE_GARDEN)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_JUNGLE_TREE)
.addOptionalTag(ConventionalBiomeTags.IS_JUNGLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerNorthDefaultHorizontalRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createAxisRotatedBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;Lnet/minecraft/data/client/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator method_64949 (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCreakingHeart (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createSubModel (Lnet/minecraft/block/Block;Ljava/lang/String;Lnet/minecraft/data/client/Model;Ljava/util/function/Function;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createPressurePlateBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createSlabBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
Expand Down Expand Up @@ -250,8 +250,8 @@ transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getTurtleEggModel (ILjava/lang/String;Lnet/minecraft/data/client/TextureMap;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getTurtleEggModel (Ljava/lang/Integer;Ljava/lang/Integer;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerWallPlant (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator method_64940 (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator method_64941 (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerPaleMossCarpet (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerHangingMoss (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator supplyChiseledBookshelfModels (Lnet/minecraft/data/client/MultipartBlockStateSupplier;Lnet/minecraft/data/client/When$PropertyCondition;Lnet/minecraft/data/client/VariantSettings$Rotation;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator supplyChiseledBookshelfModel (Lnet/minecraft/data/client/MultipartBlockStateSupplier;Lnet/minecraft/data/client/When$PropertyCondition;Lnet/minecraft/data/client/VariantSettings$Rotation;Lnet/minecraft/state/property/BooleanProperty;Lnet/minecraft/data/client/Model;Z)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerShulkerBox (Lnet/minecraft/block/Block;)V
Expand Down Expand Up @@ -292,7 +292,7 @@ transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableG
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator shortPlantDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator dropsWithShears (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator multifaceGrowthDrops (Lnet/minecraft/block/Block;Lnet/minecraft/loot/condition/LootCondition$Builder;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator method_64930 (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator paleMossCarpetDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator leavesDrops (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator oakLeavesDrops (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator mangroveLeavesDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@

@Mixin(CraftingRecipe.class)
public interface CraftingRecipeMixin {
@WrapOperation(method = "method_64671", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"))
@WrapOperation(method = "collectRecipeRemainders", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"))
private static Item captureStack(ItemStack stack, Operation<Item> operation) {
RecipeRemainderHandler.REMAINDER_STACK.set(stack.getRecipeRemainder());
return operation.call(stack);
}

@Redirect(method = "method_64671", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getRecipeRemainder()Lnet/minecraft/item/ItemStack;"))
@Redirect(method = "collectRecipeRemainders", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getRecipeRemainder()Lnet/minecraft/item/ItemStack;"))
private static ItemStack getStackRemainder(Item item) {
ItemStack remainder = RecipeRemainderHandler.REMAINDER_STACK.get();
RecipeRemainderHandler.REMAINDER_STACK.remove();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void vanillaRemainderTest(TestContext context) {
new ItemStack(Items.WATER_BUCKET),
new ItemStack(Items.DIAMOND)));

DefaultedList<ItemStack> remainderList = CraftingRecipe.method_64671(inventory);
DefaultedList<ItemStack> remainderList = CraftingRecipe.collectRecipeRemainders(inventory);

assertStackList(remainderList, "Testing vanilla recipe remainder.",
new ItemStack(Items.BUCKET),
Expand All @@ -54,7 +54,7 @@ public void fabricRemainderTest(TestContext context) {
withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 31),
new ItemStack(Items.DIAMOND)));

DefaultedList<ItemStack> remainderList = CraftingRecipe.method_64671(inventory);
DefaultedList<ItemStack> remainderList = CraftingRecipe.collectRecipeRemainders(inventory);

assertStackList(remainderList, "Testing fabric recipe remainder.",
withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class ClientRegistriesMixin {
/**
* Keep the pre-24w04a behavior of removing empty registries, even if the client knows that registry.
*/
@WrapOperation(method = "method_62155", at = @At(value = "FIELD", target = "Lnet/minecraft/registry/RegistryLoader;SYNCED_REGISTRIES:Ljava/util/List;", opcode = Opcodes.GETSTATIC))
@WrapOperation(method = "createRegistryManager", at = @At(value = "FIELD", target = "Lnet/minecraft/registry/RegistryLoader;SYNCED_REGISTRIES:Ljava/util/List;", opcode = Opcodes.GETSTATIC))
private List<RegistryLoader.Entry<?>> skipEmptyRegistries(Operation<List<RegistryLoader.Entry<?>>> operation, ResourceFactory resourceFactory, @Coerce ClientRegistriesDynamicRegistriesAccessor storage, boolean bl) {
Map<RegistryKey<? extends Registry<?>>, List<SerializableRegistries.SerializedRegistryEntry>> dynamicRegistries = storage.getDynamicRegistries();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,9 @@ public void onInitialize() {
// Synced via PacketCodecs.registryValue
RegistryAttributeHolder.get(Registries.SLOT_DISPLAY)
.addAttribute(RegistryAttribute.SYNCED);

// Synced via PacketCodecs.registryValue
RegistryAttributeHolder.get(Registries.field_54927)
.addAttribute(RegistryAttribute.SYNCED);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.jetbrains.annotations.Nullable;

import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.item.ModelTransformationMode;
import net.minecraft.util.math.Direction;

import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.item.ModelTransformationMode;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ModelTransformationMode;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MatrixUtil;
import net.minecraft.util.math.random.Random;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ModelTransformationMode;

import net.fabricmc.fabric.impl.client.indigo.renderer.render.ItemRenderContext;

Expand All @@ -43,7 +43,7 @@ public abstract class ItemRendererMixin {
@Unique
private final ThreadLocal<ItemRenderContext> fabric_contexts = ThreadLocal.withInitial(() -> new ItemRenderContext(colors));

@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;Z)V", at = @At(value = "HEAD"), cancellable = true)
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;Z)V", at = @At(value = "HEAD"), cancellable = true)
public void hook_renderItem(ItemStack stack, ModelTransformationMode transformMode, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, int overlay, BakedModel model, boolean notInHand, CallbackInfo ci) {
if (!model.isVanillaAdapter()) {
fabric_contexts.get().renderModel(stack, transformMode, matrixStack, vertexConsumerProvider, light, overlay, model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import org.jetbrains.annotations.Nullable;

import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ModelTransformationMode;

import net.fabricmc.fabric.impl.client.rendering.BuiltinItemRendererRegistryImpl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.BuiltinModelItemRenderer;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ModelTransformationMode;

import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import net.minecraft.block.entity.BannerPattern;
import net.minecraft.loot.LootTable;
import net.minecraft.recipe.RecipeManager;
import net.minecraft.recipe.ServerRecipeManager;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryEntryLookup;
import net.minecraft.registry.RegistryKey;
Expand All @@ -39,7 +39,7 @@ private static Identifier id(String path) {

@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void conditionalRecipes(TestContext context) {
RecipeManager manager = context.getWorld().getRecipeManager();
ServerRecipeManager manager = context.getWorld().getRecipeManager();

if (manager.get(RegistryKey.of(RegistryKeys.RECIPE, id("not_loaded"))).isPresent()) {
throw new AssertionError("not_loaded recipe should not have been loaded.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ private RegistryWrapper.WrapperLookup getWrapperLookup(List<ResourceReloader> li
}
}

throw new IllegalStateException("No RecipeManager found in listeners!");
throw new IllegalStateException("No ServerRecipeManager found in listeners!");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.spongepowered.asm.mixin.Mixin;

import net.minecraft.recipe.RecipeManager;
import net.minecraft.recipe.ServerRecipeManager;
import net.minecraft.server.ServerAdvancementLoader;
import net.minecraft.server.function.FunctionLoader;
import net.minecraft.util.Identifier;
Expand All @@ -32,7 +32,7 @@

@Mixin({
/* public */
RecipeManager.class, ServerAdvancementLoader.class, FunctionLoader.class
ServerRecipeManager.class, ServerAdvancementLoader.class, FunctionLoader.class
/* private */
})
public abstract class KeyedResourceReloadListenerMixin implements IdentifiableResourceReloadListener {
Expand All @@ -45,7 +45,7 @@ public Identifier getFabricId() {
if (this.fabric$id == null) {
Object self = this;

if (self instanceof RecipeManager) {
if (self instanceof ServerRecipeManager) {
this.fabric$id = ResourceReloadListenerKeys.RECIPES;
} else if (self instanceof ServerAdvancementLoader) {
this.fabric$id = ResourceReloadListenerKeys.ADVANCEMENTS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.recipe.RecipeManager;
import net.minecraft.recipe.ServerRecipeManager;
import net.minecraft.registry.RegistryWrapper;

import net.fabricmc.fabric.impl.resource.loader.FabricRecipeManager;

@Mixin(RecipeManager.class)
public class RecipeManagerMixin implements FabricRecipeManager {
@Mixin(ServerRecipeManager.class)
public class ServerRecipeManagerMixin implements FabricRecipeManager {
@Unique
private RegistryWrapper.WrapperLookup registries;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"ResourceMixin",
"ResourcePackManagerMixin",
"ResourcePackProfileMixin",
"RecipeManagerMixin",
"SelectKnownPacksC2SPacketMixin",
"ServerConfigurationNetworkHandlerMixin",
"ServerPropertiesHandlerMixin",
"ServerRecipeManagerMixin",
"SimpleResourceReloadMixin",
"SynchronizeRegistriesTaskMixin",
"TestServerMixin"
Expand Down
Loading

0 comments on commit 5763228

Please sign in to comment.