2018-09-13 12:03:28 -04:00
|
|
|
package noppes.npcs.containers;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.inventory.IInventory;
|
|
|
|
|
import net.minecraft.inventory.Slot;
|
|
|
|
|
import net.minecraft.item.ItemArmor;
|
|
|
|
|
import net.minecraft.item.ItemBlock;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
|
import noppes.npcs.roles.RoleCompanion;
|
|
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
class SlotCompanionArmor extends Slot {
|
2018-09-13 12:03:28 -04:00
|
|
|
|
|
|
|
|
final int armorType;
|
|
|
|
|
final RoleCompanion role;
|
|
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
public SlotCompanionArmor(RoleCompanion role, IInventory iinventory, int id, int x, int y, int type) {
|
2018-09-13 12:03:28 -04:00
|
|
|
super(iinventory, id, x, y);
|
|
|
|
|
armorType = type;
|
|
|
|
|
this.role = role;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
@Override
|
|
|
|
|
public int getSlotStackLimit() {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IIcon getBackgroundIconIndex() {
|
|
|
|
|
return ItemArmor.func_94602_b(this.armorType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isItemValid(ItemStack itemstack) {
|
|
|
|
|
if (itemstack.getItem() instanceof ItemArmor && role.canWearArmor(itemstack))
|
|
|
|
|
return ((ItemArmor) itemstack.getItem()).armorType == armorType;
|
|
|
|
|
|
|
|
|
|
if (itemstack.getItem() instanceof ItemBlock)
|
|
|
|
|
return armorType == 0;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|