BloodMagic/src/main/java/WayofTime/bloodmagic/api/impl/ItemBindable.java

36 lines
911 B
Java
Raw Normal View History

package WayofTime.bloodmagic.api.impl;
2017-08-15 21:30:48 -07:00
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
/**
* Base class for all bindable items.
*/
2017-08-15 21:30:48 -07:00
public class ItemBindable extends Item implements IBindable {
public ItemBindable() {
super();
setMaxStackSize(1);
}
// IBindable
@Override
2017-08-15 21:30:48 -07:00
public boolean onBind(EntityPlayer player, ItemStack stack) {
return true;
}
@Override
2017-08-15 21:30:48 -07:00
public String getOwnerName(ItemStack stack) {
2017-08-15 20:21:54 -07:00
return !stack.isEmpty() ? stack.getTagCompound().getString(Constants.NBT.OWNER_NAME) : null;
}
@Override
2017-08-15 21:30:48 -07:00
public String getOwnerUUID(ItemStack stack) {
2017-08-15 20:21:54 -07:00
return !stack.isEmpty() ? stack.getTagCompound().getString(Constants.NBT.OWNER_UUID) : null;
}
}