Simplify ingredient handling and remove generated verification files
This commit is contained in:
@@ -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 -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user