Migrate AstraSoups to NeoForge as AstraCauldron
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package online.astradev.cauldron.mixin;
|
||||
|
||||
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;
|
||||
|
||||
/** 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) {
|
||||
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" -> components.set(DataComponents.MAX_STACK_SIZE, 16);
|
||||
default -> { }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user