/** * MrCrayfish's Furniture Mod * Copyright (C) 2016 MrCrayfish (http://www.mrcrayfish.com/) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.mrcrayfish.furniture.gui.slots; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; public class SlotTool extends Slot { private int toolType; public SlotTool(IInventory dishwasher, int id, int x, int y, int toolType) { super(dishwasher, id, x, y); this.toolType = toolType; } @Override public boolean isItemValid(ItemStack par1ItemStack) { if (par1ItemStack == null) { return false; } Item item = par1ItemStack.getItem(); switch (toolType) { case 0: if (item instanceof ItemPickaxe) { return true; } break; case 1: if (item instanceof ItemSpade) { return true; } break; case 2: if (item instanceof ItemSword) { return true; } break; case 3: if (item instanceof ItemAxe) { return true; } break; case 4: if (item instanceof ItemHoe) { return true; } break; case 5: if (item instanceof ItemBow) { return true; } break; } return false; } }