mod for the islanders smp
1package net.radsteve.islanders.mixin;
2
3import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
4import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
5import net.minecraft.item.Item;
6import net.minecraft.item.ItemStack;
7import net.radsteve.islanders.rule.RuleManager;
8import org.spongepowered.asm.mixin.Mixin;
9import org.spongepowered.asm.mixin.Shadow;
10
11@Mixin(ItemStack.class)
12public abstract class ItemStackMixin {
13 @Shadow
14 public abstract Item getItem();
15
16 @WrapMethod(method = "getMaxCount")
17 private int islanders$getMaxCount(Operation<Integer> original) {
18 final Integer limit = RuleManager.INSTANCE.limitFor(getItem());
19
20 if (limit == null) {
21 return original.call();
22 } else {
23 return limit;
24 }
25 }
26}