Move getOwnerName/UUID to IBindable
Where it should have been to begin with... hehe... Deprecated methods will be removed after beta
This commit is contained in:
parent
8c1eaddb97
commit
fd16a58b6b
8 changed files with 72 additions and 11 deletions
|
@ -3,11 +3,38 @@ package WayofTime.bloodmagic.api.iface;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* If the item is not bound, this will be null.
|
||||
*
|
||||
* @param stack
|
||||
* - The owned ItemStack
|
||||
*
|
||||
* @return - The username of the Item's owner
|
||||
*/
|
||||
String getOwnerName(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the UUID of the Item's owner.
|
||||
*
|
||||
* If the item is not bound, this will be null.
|
||||
*
|
||||
* @param stack
|
||||
* - The owned ItemStack
|
||||
*
|
||||
* @return - The UUID of the Item's owner
|
||||
*/
|
||||
String getOwnerUUID(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Called when the player attempts to bind the item.
|
||||
*
|
||||
|
|
|
@ -44,14 +44,19 @@ public class BindableHelper
|
|||
stack.getTagCompound().setString(Constants.NBT.OWNER_UUID, ownerUUID);
|
||||
}
|
||||
|
||||
// Everything below is to be removed.
|
||||
|
||||
/**
|
||||
* Used to safely obtain the username of the ItemStack's owner
|
||||
* Deprecated.
|
||||
*
|
||||
* Built into {@link IBindable} now.
|
||||
*
|
||||
* @param stack
|
||||
* - The ItemStack to check the owner of
|
||||
*
|
||||
* @return - The username of the ItemStack's owner
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getOwnerName(ItemStack stack)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
|
@ -60,13 +65,16 @@ public class BindableHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Used to safely obtain the UUID of the ItemStack's owner
|
||||
* Deprecated.
|
||||
*
|
||||
* Built into {@link IBindable} now.
|
||||
*
|
||||
* @param stack
|
||||
* - The ItemStack to check the owner of
|
||||
*
|
||||
* @return - The UUID of the ItemStack's owner
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getOwnerUUID(ItemStack stack)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
|
@ -74,8 +82,6 @@ public class BindableHelper
|
|||
return stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||
}
|
||||
|
||||
// Everything below is to be removed.
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue