Remove unnecessary base bindable class

Jarbo 8 exists
This commit is contained in:
Nicholas Ignoffo 2018-02-13 17:24:06 -08:00
parent 3fb708d2be
commit 65b89795bc
5 changed files with 25 additions and 55 deletions

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.apibutnotreally.iface;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -7,6 +8,7 @@ import net.minecraft.item.ItemStack;
* Implement this interface on any Item that can be bound to a player.
*/
public interface IBindable {
/**
* Gets the username of the Item's owner. Usually for display, such as in
* the tooltip.
@ -16,7 +18,9 @@ public interface IBindable {
* @param stack - The owned ItemStack
* @return - The username of the Item's owner
*/
String getOwnerName(ItemStack stack);
default String getOwnerName(ItemStack stack) {
return !stack.isEmpty() && stack.hasTagCompound() ? stack.getTagCompound().getString(Constants.NBT.OWNER_NAME) : null;
}
/**
* Gets the UUID of the Item's owner.
@ -26,7 +30,9 @@ public interface IBindable {
* @param stack - The owned ItemStack
* @return - The UUID of the Item's owner
*/
String getOwnerUUID(ItemStack stack);
default String getOwnerUUID(ItemStack stack) {
return !stack.isEmpty() && stack.hasTagCompound() ? stack.getTagCompound().getString(Constants.NBT.OWNER_UUID) : null;
}
/**
* Called when the player attempts to bind the item.
@ -35,5 +41,7 @@ public interface IBindable {
* @param stack - The ItemStack to attempt binding
* @return If binding was successful.
*/
boolean onBind(EntityPlayer player, ItemStack stack);
default boolean onBind(EntityPlayer player, ItemStack stack) {
return true;
}
}