mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-21 20:42:26 +00:00
24 lines
633 B
Java
24 lines
633 B
Java
package slimeknights.mantle.inventory;
|
|
|
|
import net.minecraft.inventory.IInventory;
|
|
import net.minecraft.inventory.Slot;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
public class SlotRestrictedItem extends Slot {
|
|
|
|
private final Item allowedItem;
|
|
|
|
public SlotRestrictedItem(Item item, IInventory inventoryIn, int index, int xPosition, int yPosition) {
|
|
super(inventoryIn, index, xPosition, yPosition);
|
|
allowedItem = item;
|
|
}
|
|
|
|
@Override
|
|
public boolean isItemValid(@Nonnull ItemStack stack) {
|
|
return !stack.isEmpty() && stack.getItem() == allowedItem;
|
|
}
|
|
}
|