Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mod to Minecraft snapshot 24w40a #4136

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static LoadedTag loadTag(TagKey<?> tagKey) {
tagEntry.resolve(new TagEntry.ValueGetter<>() {
@Nullable
@Override
public Identifier direct(Identifier id) {
public Identifier direct(Identifier id, boolean required) {
immediateChildIds.add(id);
return id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

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;
Expand Down Expand Up @@ -94,6 +95,9 @@ private void generateCategoryTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.IS_BIRCH_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DARK_FOREST)
.add(BiomeKeys.DARK_FOREST)
.addOptional(class_10351.PALE_GARDEN);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_OCEAN)
.addOptionalTag(BiomeTags.IS_OCEAN)
.addOptionalTag(ConventionalBiomeTags.IS_DEEP_OCEAN)
Expand Down Expand Up @@ -175,6 +179,7 @@ private void generateClimateAndVegetationTags() {
.add(BiomeKeys.SWAMP)
.add(BiomeKeys.STONY_SHORE)
.add(BiomeKeys.DARK_FOREST)
.addOptional(class_10351.PALE_GARDEN)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST)
Expand Down Expand Up @@ -247,6 +252,7 @@ private void generateClimateAndVegetationTags() {

getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_DENSE_OVERWORLD)
.add(BiomeKeys.DARK_FOREST)
.addOptional(class_10351.PALE_GARDEN)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA)
.add(BiomeKeys.JUNGLE)
Expand Down Expand Up @@ -279,6 +285,7 @@ private void generateClimateAndVegetationTags() {
.add(BiomeKeys.FLOWER_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.DARK_FOREST)
.addOptional(class_10351.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 @@ -385,6 +385,7 @@ public void generateTranslations(RegistryWrapper.WrapperLookup registryLookup, T
translationBuilder.add(ConventionalBiomeTags.IS_SNOWY_PLAINS, "Snowy Plains");
translationBuilder.add(ConventionalBiomeTags.IS_FOREST, "Forest");
translationBuilder.add(ConventionalBiomeTags.IS_BIRCH_FOREST, "Birch Forest");
translationBuilder.add(ConventionalBiomeTags.IS_DARK_FOREST, "Dark Forest");
translationBuilder.add(ConventionalBiomeTags.IS_FLOWER_FOREST, "Flower Forest");
translationBuilder.add(ConventionalBiomeTags.IS_TAIGA, "Taiga");
translationBuilder.add(ConventionalBiomeTags.IS_OLD_GROWTH, "Old Growth");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@
"tag.worldgen.biome.c.is_cold": "Cold",
"tag.worldgen.biome.c.is_cold.end": "Cold End",
"tag.worldgen.biome.c.is_cold.overworld": "Cold Overworld",
"tag.worldgen.biome.c.is_dark_forest": "Dark Forest",
"tag.worldgen.biome.c.is_dead": "Dead",
"tag.worldgen.biome.c.is_deep_ocean": "Deep Ocean",
"tag.worldgen.biome.c.is_dense_vegetation": "Dense Vegetation",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"values": [
"minecraft:dark_forest",
{
"id": "minecraft:pale_garden",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"values": [
"minecraft:dark_forest",
{
"id": "minecraft:pale_garden",
"required": false
},
"minecraft:old_growth_birch_forest",
"minecraft:old_growth_spruce_taiga",
"minecraft:jungle",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"minecraft:swamp",
"minecraft:stony_shore",
"minecraft:dark_forest",
{
"id": "minecraft:pale_garden",
"required": false
},
"minecraft:windswept_forest",
"minecraft:birch_forest",
"minecraft:old_growth_birch_forest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"minecraft:flower_forest",
"minecraft:birch_forest",
"minecraft:dark_forest",
{
"id": "minecraft:pale_garden",
"required": false
},
"minecraft:old_growth_birch_forest",
{
"id": "#c:tree_deciduous",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ private ConventionalBiomeTags() {
*/
public static final TagKey<Biome> IS_FOREST = register("is_forest");
public static final TagKey<Biome> IS_BIRCH_FOREST = register("is_birch_forest");
public static final TagKey<Biome> IS_DARK_FOREST = register("is_dark_forest");
public static final TagKey<Biome> IS_FLOWER_FOREST = register("is_flower_forest");
public static final TagKey<Biome> IS_TAIGA = register("is_taiga");
public static final TagKey<Biome> IS_OLD_GROWTH = register("is_old_growth");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.recipe.Recipe;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryOps;
import net.minecraft.registry.RegistryWrapper;
Expand Down Expand Up @@ -77,9 +78,9 @@ protected RecipeExporter withConditions(RecipeExporter exporter, ResourceConditi
Preconditions.checkArgument(conditions.length > 0, "Must add at least one condition.");
return new RecipeExporter() {
@Override
public void accept(Identifier identifier, Recipe<?> recipe, @Nullable AdvancementEntry advancementEntry) {
public void accept(RegistryKey<Recipe<?>> key, Recipe<?> recipe, @Nullable AdvancementEntry advancementEntry) {
FabricDataGenHelper.addConditions(recipe, conditions);
exporter.accept(identifier, recipe, advancementEntry);
exporter.accept(key, recipe, advancementEntry);
}

@Override
Expand All @@ -100,8 +101,8 @@ public CompletableFuture<?> run(DataWriter writer) {
List<CompletableFuture<?>> list = new ArrayList<>();
RecipeGenerator recipeGenerator = getRecipeGenerator(wrapperLookup, new RecipeExporter() {
@Override
public void accept(Identifier recipeId, Recipe<?> recipe, @Nullable AdvancementEntry advancement) {
Identifier identifier = getRecipeIdentifier(recipeId);
public void accept(RegistryKey<Recipe<?>> recipeKey, Recipe<?> recipe, @Nullable AdvancementEntry advancement) {
Identifier identifier = getRecipeIdentifier(recipeKey.getValue());

if (!generatedRecipes.add(identifier)) {
throw new IllegalStateException("Duplicate recipe " + identifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator of
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerBlasting (Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerMultipleOptions (Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerNetheriteUpgradeRecipe (Lnet/minecraft/item/Item;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSmithingTrimRecipe (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSmithingTrimRecipe (Lnet/minecraft/item/Item;Lnet/minecraft/registry/RegistryKey;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offer2x2CompactingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerCompactingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerCompactingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
Expand Down Expand Up @@ -178,6 +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 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 @@ -249,6 +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 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 @@ -289,6 +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 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 @@ -98,6 +98,6 @@ public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView heightL
}

@Override
public void getDebugHudText(List<String> list, NoiseConfig noiseConfig, BlockPos blockPos) {
public void appendDebugHudText(List<String> list, NoiseConfig noiseConfig, BlockPos blockPos) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ default boolean allowContinuingBlockBreaking(PlayerEntity player, ItemStack oldS
* @return the leftover item stack
*/
default ItemStack getRecipeRemainder(ItemStack stack) {
return ((Item) this).hasRecipeRemainder() ? ((Item) this).getRecipeRemainder().getDefaultStack() : ItemStack.EMPTY;
return ((Item) this).getRecipeRemainder();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.RecipeEntry;
import net.minecraft.recipe.input.SingleStackRecipeInput;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

@Mixin(AbstractFurnaceBlockEntity.class)
public abstract class AbstractFurnaceBlockEntityMixin {
@Unique
private static final ThreadLocal<ItemStack> REMAINDER_STACK = new ThreadLocal<>();

@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"), locals = LocalCapture.CAPTURE_FAILHARD, allow = 1)
private static void getStackRemainder(World world, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity blockEntity, CallbackInfo ci, boolean bl, boolean bl2, ItemStack itemStack, ItemStack itemStack2, boolean bl3, boolean bl4, RecipeEntry recipeEntry, int i) {
private static void getStackRemainder(ServerWorld world, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity blockEntity, CallbackInfo ci, boolean bl, boolean bl2, ItemStack itemStack, ItemStack itemStack2, boolean bl3, boolean bl4, RecipeEntry recipeEntry, SingleStackRecipeInput input, int i) {
REMAINDER_STACK.set(itemStack.getRecipeRemainder());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
import net.minecraft.screen.ForgingScreenHandler;
import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.screen.slot.ForgingSlotsManager;

import net.fabricmc.fabric.api.item.v1.EnchantingContext;

@Mixin(AnvilScreenHandler.class)
abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler {
AnvilScreenHandlerMixin(@Nullable ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory, ScreenHandlerContext context) {
super(type, syncId, playerInventory, context);
AnvilScreenHandlerMixin(@Nullable ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory, ScreenHandlerContext context, ForgingSlotsManager forgingSlotsManager) {
super(type, syncId, playerInventory, context, forgingSlotsManager);
}

@Redirect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package net.fabricmc.fabric.mixin.item;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -28,7 +26,6 @@

import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
Expand All @@ -44,16 +41,11 @@ private static void captureItemStack(World world, BlockPos pos, DefaultedList<It
REMAINDER_STACK.set(itemStack.getRecipeRemainder());
}

@Redirect(method = "craft", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;hasRecipeRemainder()Z"))
private static boolean hasStackRecipeRemainder(Item instance) {
return !REMAINDER_STACK.get().isEmpty();
}

/**
* Injected after the {@link Item#getRecipeRemainder} to replace the old remainder with are new one.
* Wrap the {@link Item#getRecipeRemainder} call to replace the old remainder with the new one.
*/
@WrapOperation(method = "craft", at = @At(value = "NEW", target = "(Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/item/ItemStack;"))
private static ItemStack createStackRecipeRemainder(ItemConvertible item, Operation<ItemStack> original) {
@Redirect(method = "craft", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getRecipeRemainder()Lnet/minecraft/item/ItemStack;"))
private static ItemStack createStackRecipeRemainder(Item item) {
ItemStack remainder = REMAINDER_STACK.get();
REMAINDER_STACK.remove();
return remainder;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.item;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.CraftingRecipe;

import net.fabricmc.fabric.impl.item.RecipeRemainderHandler;

@Mixin(CraftingRecipe.class)
public interface CraftingRecipeMixin {
@WrapOperation(method = "method_64671", 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;"))
private static ItemStack getStackRemainder(Item item) {
ItemStack remainder = RecipeRemainderHandler.REMAINDER_STACK.get();
RecipeRemainderHandler.REMAINDER_STACK.remove();
return remainder;
}
}
Loading
Loading