diff --git a/src/main/java/io/fabricatedatelier/mayor/util/HandledInventory.java b/src/main/java/io/fabricatedatelier/mayor/util/HandledInventory.java index b4708d4..082630a 100644 --- a/src/main/java/io/fabricatedatelier/mayor/util/HandledInventory.java +++ b/src/main/java/io/fabricatedatelier/mayor/util/HandledInventory.java @@ -3,6 +3,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Inventories; import net.minecraft.inventory.SidedInventory; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.math.Direction; @@ -77,6 +78,20 @@ default ItemStack removeStack(int slot, int amount) { return stack; } + default boolean contains(Item item) { + for (ItemStack stack : this.getItems()) { + if (stack.getItem().equals(item)) return true; + } + return false; + } + + default boolean contains(ItemStack stack) { + for (ItemStack entry : this.getItems()) { + if (entry.equals(stack)) return true; + } + return false; + } + @Override default boolean canPlayerUse(PlayerEntity player) { return true; @@ -87,4 +102,8 @@ default void clear() { getItems().clear(); markDirty(); } + + default void markDirty() { + + } }