Simplify ingredient handling and remove generated verification files

This commit is contained in:
2026-09-13 21:55:44 +03:00
parent fcd84c7024
commit ce5a37e139
31 changed files with 1596 additions and 914 deletions
@@ -5,6 +5,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.item.crafting.*;
import net.minecraft.world.level.block.entity.CampfireBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -13,8 +14,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(CampfireBlockEntity.class)
public abstract class CampfireHeatMixin {
@Inject(method = "cookTick", at = @At("TAIL"))
private static void astracauldron$heat(ServerLevel level, BlockPos pos, BlockState state, CampfireBlockEntity entity,
RecipeManager.CachedCheck<SingleRecipeInput, CampfireCookingRecipe> recipes, CallbackInfo ci) {
private static void astracauldron$heat(
ServerLevel level,
BlockPos pos,
BlockState state,
CampfireBlockEntity entity,
RecipeManager.CachedCheck<SingleRecipeInput, CampfireCookingRecipe> recipes,
CallbackInfo ci) {
online.astradev.cauldron.CauldronHeat.tick(level, pos);
}
}
@@ -6,7 +6,9 @@ import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import online.astradev.cauldron.AstraCauldron;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -15,11 +17,18 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin({CauldronBlock.class, LayeredCauldronBlock.class})
abstract class CauldronWeatherMixin {
@Inject(method = "handlePrecipitation", at = @At("HEAD"), cancellable = true)
private void soups$rain(BlockState state, Level level, BlockPos pos, Biome.Precipitation precipitation, CallbackInfo ci) {
private void soups$rain(
BlockState state,
Level level,
BlockPos pos,
Biome.Precipitation precipitation,
CallbackInfo ci) {
if (AstraCauldron.occupied(level, pos)) ci.cancel();
}
@Inject(method = "receiveStalactiteDrip", at = @At("HEAD"), cancellable = true)
private void soups$drip(BlockState state, Level level, BlockPos pos, Fluid fluid, CallbackInfo ci) {
private void soups$drip(
BlockState state, Level level, BlockPos pos, Fluid fluid, CallbackInfo ci) {
if (AstraCauldron.occupied(level, pos)) ci.cancel();
}
}
@@ -4,7 +4,9 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.LayeredCauldronBlock;
import net.minecraft.world.level.block.state.BlockState;
import online.astradev.cauldron.AstraCauldron;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -4,6 +4,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.component.*;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -11,16 +12,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/** Per-stack patch is sent to vanilla clients; no change to their assumed item defaults. */
@Mixin(ItemStack.class)
abstract class SoupStackMixin {
@Inject(method = "<init>(Lnet/minecraft/core/Holder;ILnet/minecraft/core/component/PatchedDataComponentMap;)V", at = @At("RETURN"))
private void soups$stackSize(Holder<Item> item, int count, PatchedDataComponentMap components, CallbackInfo ci) {
@Inject(
method =
"<init>(Lnet/minecraft/core/Holder;ILnet/minecraft/core/component/PatchedDataComponentMap;)V",
at = @At("RETURN"))
private void soups$stackSize(
Holder<Item> item, int count, PatchedDataComponentMap components, CallbackInfo ci) {
var key = item.unwrapKey().orElse(null);
if (key == null || !key.identifier().getNamespace().equals("minecraft")) return;
switch (key.identifier().getPath()) {
case "mushroom_stew", "rabbit_stew", "beetroot_soup", "suspicious_stew" -> {
var config = online.astradev.cauldron.AstraCauldron.config();
if (config.normalizeVanillaSoups) components.set(DataComponents.MAX_STACK_SIZE, config.soupStackSize);
if (config.normalizeVanillaSoups)
components.set(DataComponents.MAX_STACK_SIZE, config.soupStackSize);
}
default -> { }
default -> {}
}
}
}