2018-02-15 18:49:01 -08:00
|
|
|
package WayofTime.bloodmagic.iface;
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2018-02-15 18:49:01 -08:00
|
|
|
import WayofTime.bloodmagic.util.Constants;
|
2015-10-29 20:22:14 -07:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implement this interface on any Item that can be bound to a player.
|
|
|
|
*/
|
2017-08-15 21:30:48 -07:00
|
|
|
public interface IBindable {
|
2018-02-13 17:24:06 -08:00
|
|
|
|
2016-02-04 00:25:37 -08:00
|
|
|
/**
|
2016-03-16 18:41:06 -04:00
|
|
|
* Gets the username of the Item's owner. Usually for display, such as in
|
|
|
|
* the tooltip.
|
2017-08-15 21:30:48 -07:00
|
|
|
* <p>
|
2016-02-04 00:25:37 -08:00
|
|
|
* If the item is not bound, this will be null.
|
2017-08-15 21:30:48 -07:00
|
|
|
*
|
|
|
|
* @param stack - The owned ItemStack
|
2016-02-04 00:25:37 -08:00
|
|
|
* @return - The username of the Item's owner
|
|
|
|
*/
|
2018-02-13 17:24:06 -08:00
|
|
|
default String getOwnerName(ItemStack stack) {
|
|
|
|
return !stack.isEmpty() && stack.hasTagCompound() ? stack.getTagCompound().getString(Constants.NBT.OWNER_NAME) : null;
|
|
|
|
}
|
2016-02-04 00:25:37 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the UUID of the Item's owner.
|
2017-08-15 21:30:48 -07:00
|
|
|
* <p>
|
2016-02-04 00:25:37 -08:00
|
|
|
* If the item is not bound, this will be null.
|
2017-08-15 21:30:48 -07:00
|
|
|
*
|
|
|
|
* @param stack - The owned ItemStack
|
2016-02-04 00:25:37 -08:00
|
|
|
* @return - The UUID of the Item's owner
|
|
|
|
*/
|
2018-02-13 17:24:06 -08:00
|
|
|
default String getOwnerUUID(ItemStack stack) {
|
|
|
|
return !stack.isEmpty() && stack.hasTagCompound() ? stack.getTagCompound().getString(Constants.NBT.OWNER_UUID) : null;
|
|
|
|
}
|
2016-02-04 00:25:37 -08:00
|
|
|
|
2015-10-29 20:22:14 -07:00
|
|
|
/**
|
|
|
|
* Called when the player attempts to bind the item.
|
2017-08-15 21:30:48 -07:00
|
|
|
*
|
|
|
|
* @param player - The Player attempting to bind the item
|
|
|
|
* @param stack - The ItemStack to attempt binding
|
2016-01-01 10:52:42 -08:00
|
|
|
* @return If binding was successful.
|
2015-10-29 20:22:14 -07:00
|
|
|
*/
|
2018-02-13 17:24:06 -08:00
|
|
|
default boolean onBind(EntityPlayer player, ItemStack stack) {
|
|
|
|
return true;
|
|
|
|
}
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|