Clean up some of the filtering - a lot of unnecessary repeated code removed
This commit is contained in:
parent
d4bd9fca02
commit
cf78ff792a
|
@ -5,42 +5,46 @@ import cpw.mods.fml.common.Mod;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public final class RecipeRegistryProxy
|
||||
{
|
||||
public static void addRecipe(Object recipeOutput, List<?> recipeInputList)
|
||||
{
|
||||
init();
|
||||
/**
|
||||
* @deprecated
|
||||
* @see com.pahimar.ee3.api.recipe.RecipeRegistryProxy
|
||||
*/
|
||||
@Deprecated
|
||||
public final class RecipeRegistryProxy {
|
||||
|
||||
// NOOP if EquivalentExchange3 is not present
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
EE3Wrapper.ee3mod.getRecipeRegistry().addRecipe(recipeOutput, recipeInputList);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param recipeOutput
|
||||
* @param recipeInputList
|
||||
* @see com.pahimar.ee3.api.recipe.RecipeRegistryProxy#addRecipe(Object, List)
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addRecipe(Object recipeOutput, List<?> recipeInputList) {
|
||||
|
||||
com.pahimar.ee3.api.recipe.RecipeRegistryProxy.addRecipe(recipeOutput, recipeInputList);
|
||||
}
|
||||
|
||||
public static void dumpRecipeRegistryToLog()
|
||||
{
|
||||
init();
|
||||
/**
|
||||
* @deprecated
|
||||
* @see com.pahimar.ee3.api.recipe.RecipeRegistryProxy#dumpRecipeRegistryToLog()
|
||||
*/
|
||||
@Deprecated
|
||||
public static void dumpRecipeRegistryToLog() {
|
||||
|
||||
// NOOP if EquivalentExchange3 is not present
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
EE3Wrapper.ee3mod.getRecipeRegistry().dumpRecipeRegistryToLog();
|
||||
}
|
||||
com.pahimar.ee3.api.recipe.RecipeRegistryProxy.dumpRecipeRegistryToLog();
|
||||
}
|
||||
|
||||
@Mod.Instance("EE3")
|
||||
private static Object ee3Mod;
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static class EE3Wrapper {
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
|
||||
private static void init()
|
||||
{
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
private static void init() {
|
||||
|
||||
if (ee3Mod != null) {
|
||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.pahimar.ee3.api.recipe;
|
||||
|
||||
import com.pahimar.ee3.EquivalentExchange3;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class RecipeRegistryProxy {
|
||||
|
||||
public static void addRecipe(Object recipeOutput, List<?> recipeInputList) {
|
||||
|
||||
init();
|
||||
|
||||
// NOOP if EquivalentExchange3 is not present
|
||||
if (ee3Mod != null) {
|
||||
EE3Wrapper.ee3mod.getRecipeRegistry().addRecipe(recipeOutput, recipeInputList);
|
||||
}
|
||||
}
|
||||
|
||||
public static void dumpRecipeRegistryToLog() {
|
||||
|
||||
init();
|
||||
|
||||
// NOOP if EquivalentExchange3 is not present
|
||||
if (ee3Mod != null) {
|
||||
EE3Wrapper.ee3mod.getRecipeRegistry().dumpRecipeRegistryToLog();
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.Instance("EE3")
|
||||
private static Object ee3Mod;
|
||||
|
||||
private static class EE3Wrapper {
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
|
||||
private static void init() {
|
||||
|
||||
if (ee3Mod != null) {
|
||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -188,7 +188,7 @@ public class ContainerAlchenomicon extends ContainerEE implements IElementButton
|
|||
this.requiresUpdate = true;
|
||||
boolean shouldUpdateInventory = false;
|
||||
ItemStack[] newInventory = new ItemStack[80];
|
||||
List<ItemStack> filteredList = new ArrayList(FilterUtils.filterByNameContains(inventoryAlchenomicon.getKnownTransmutations(), searchTerm, Comparators.displayNameComparator));
|
||||
List<ItemStack> filteredList = new ArrayList(FilterUtils.filterByDisplayName(inventoryAlchenomicon.getKnownTransmutations(), searchTerm, FilterUtils.NameFilterType.CONTAINS, Comparators.displayNameComparator));
|
||||
|
||||
maxPageOffset = filteredList.size() / 80;
|
||||
if (pageOffset > maxPageOffset)
|
||||
|
|
|
@ -62,7 +62,7 @@ public abstract class ContainerEE extends Container
|
|||
|
||||
if (slot.isItemValid(itemStack) && stackInSlot == null)
|
||||
{
|
||||
slot.putStack(ItemHelper.cloneItemStack(itemStack, Math.min(itemStack.stackSize, slot.getSlotStackLimit())));
|
||||
slot.putStack(ItemHelper.clone(itemStack, Math.min(itemStack.stackSize, slot.getSlotStackLimit())));
|
||||
slot.onSlotChanged();
|
||||
|
||||
if (slot.getStack() != null)
|
||||
|
|
|
@ -202,7 +202,7 @@ public class ContainerTransmutationTablet extends ContainerEE implements IElemen
|
|||
{
|
||||
ItemStack[] newInventory = new ItemStack[30];
|
||||
|
||||
Set<ItemStack> filteredSet = FilterUtils.filterByNameContains(this.inventoryTransmutationTablet.getKnownTransmutations(), searchTerm);
|
||||
Set<ItemStack> filteredSet = FilterUtils.filterByDisplayName(this.inventoryTransmutationTablet.getKnownTransmutations(), searchTerm, FilterUtils.NameFilterType.CONTAINS);
|
||||
List<ItemStack> filteredList = new ArrayList(FilterUtils.filterByEnergyValue(filteredSet, energyValue));
|
||||
|
||||
int adjustedStartIndex = (int) ((scrollBarPosition / 187f) * filteredList.size());
|
||||
|
|
|
@ -90,12 +90,12 @@ public class TransmutationKnowledge implements JsonSerializer<TransmutationKnowl
|
|||
|
||||
public Set<ItemStack> filterByNameStartsWith(String filterString)
|
||||
{
|
||||
return FilterUtils.filterByNameStartsWith(getKnownTransmutations(), filterString);
|
||||
return FilterUtils.filterByDisplayName(getKnownTransmutations(), filterString, FilterUtils.NameFilterType.STARTS_WITH);
|
||||
}
|
||||
|
||||
public Set<ItemStack> filterByNameContains(String filterString)
|
||||
{
|
||||
return FilterUtils.filterByNameContains(getKnownTransmutations(), filterString);
|
||||
return FilterUtils.filterByDisplayName(getKnownTransmutations(), filterString, FilterUtils.NameFilterType.CONTAINS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -67,7 +67,7 @@ public class TransmutationKnowledgeRegistry
|
|||
loadTemplateKnowledgeFromDisk();
|
||||
}
|
||||
|
||||
return FilterUtils.filterByNameStartsWith(templateKnowledge.getKnownTransmutations(), filterString);
|
||||
return FilterUtils.filterByDisplayName(templateKnowledge.getKnownTransmutations(), filterString, FilterUtils.NameFilterType.STARTS_WITH);
|
||||
}
|
||||
|
||||
public Set<ItemStack> getTemplatesKnownTransmutationsFilteredContains(String filterString)
|
||||
|
@ -77,7 +77,7 @@ public class TransmutationKnowledgeRegistry
|
|||
loadTemplateKnowledgeFromDisk();
|
||||
}
|
||||
|
||||
return FilterUtils.filterByNameContains(templateKnowledge.getKnownTransmutations(), filterString);
|
||||
return FilterUtils.filterByDisplayName(templateKnowledge.getKnownTransmutations(), filterString, FilterUtils.NameFilterType.CONTAINS);
|
||||
}
|
||||
|
||||
public boolean doesTemplateKnow(ItemStack itemStack)
|
||||
|
|
|
@ -71,6 +71,7 @@ public class RecipeRegistry {
|
|||
public Multimap<WrappedStack, List<WrappedStack>> getRecipeMappings() {
|
||||
|
||||
if (immutableRecipeMap == null) {
|
||||
// FIXME Check to ensure we don't have multiple entries {@link https://github.com/pahimar/Equivalent-Exchange-3/issues/1046}
|
||||
immutableRecipeMap = ImmutableMultimap.copyOf(recipeRegistry.recipeMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,153 +3,104 @@ package com.pahimar.ee3.util;
|
|||
import com.pahimar.ee3.api.exchange.EnergyValue;
|
||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
||||
import com.pahimar.ee3.reference.Comparators;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class FilterUtils
|
||||
{
|
||||
public static Set<ItemStack> filterForItemBlock(Set<ItemStack> unfilteredItemStackSet)
|
||||
{
|
||||
return filterForItemBlock(unfilteredItemStackSet, Comparators.idComparator);
|
||||
public class FilterUtils {
|
||||
|
||||
public static Set<ItemStack> filterByDisplayName(Set<ItemStack> itemStacks, String filterString) {
|
||||
return filterByDisplayName(itemStacks, filterString, NameFilterType.STARTS_WITH, null);
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterForItemBlock(Set<ItemStack> unfilteredItemStackSet, Comparator comparator)
|
||||
{
|
||||
Set<ItemStack> itemBlockOnlySet = new TreeSet<ItemStack>(comparator);
|
||||
public static Set<ItemStack> filterByDisplayName(Set<ItemStack> itemStacks, String filterString, NameFilterType filterType) {
|
||||
return filterByDisplayName(itemStacks, filterString, filterType, null);
|
||||
}
|
||||
|
||||
for (ItemStack itemStack : unfilteredItemStackSet)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
itemBlockOnlySet.add(itemStack);
|
||||
public static Set<ItemStack> filterByDisplayName(Collection<ItemStack> itemStacks, String filterString, NameFilterType filterType, Comparator comparator) {
|
||||
|
||||
Set<ItemStack> filteredSet = (comparator != null ? new TreeSet<>(comparator) : new TreeSet<>(Comparators.displayNameComparator));
|
||||
|
||||
if (itemStacks != null) {
|
||||
if (filterString == null || filterString.isEmpty()) {
|
||||
filteredSet.addAll(itemStacks);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (ItemStack itemStack : itemStacks) {
|
||||
|
||||
return itemBlockOnlySet;
|
||||
}
|
||||
String itemDisplayName = itemStack.getDisplayName().toLowerCase();
|
||||
|
||||
public static Set<ItemStack> filterByNameStartsWith(Set<ItemStack> unfilteredItemStackSet, String filterString)
|
||||
{
|
||||
return filterByNameStartsWith(unfilteredItemStackSet, filterString, Comparators.idComparator);
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByNameStartsWith(Set<ItemStack> unfilteredItemStackSet, String filterString, Comparator comparator)
|
||||
{
|
||||
Set<ItemStack> nameSortedSet = new TreeSet<ItemStack>(comparator);
|
||||
|
||||
for (ItemStack itemStack : unfilteredItemStackSet)
|
||||
{
|
||||
String itemDisplayName = itemStack.getDisplayName().toLowerCase();
|
||||
|
||||
if (filterString != null)
|
||||
{
|
||||
if (itemDisplayName.startsWith(filterString.toLowerCase()))
|
||||
{
|
||||
nameSortedSet.add(itemStack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nameSortedSet.add(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
return nameSortedSet;
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByNameContains(Collection<ItemStack> unfilteredCollection, String filterString)
|
||||
{
|
||||
Set<ItemStack> nameSortedSet = new HashSet<ItemStack>();
|
||||
|
||||
for (ItemStack itemStack : unfilteredCollection)
|
||||
{
|
||||
String itemDisplayName = itemStack.getDisplayName().toLowerCase();
|
||||
|
||||
if (filterString != null)
|
||||
{
|
||||
if (itemDisplayName.contains(filterString.toLowerCase()))
|
||||
{
|
||||
nameSortedSet.add(itemStack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nameSortedSet.add(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
return nameSortedSet;
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByNameContains(Collection<ItemStack> unfilteredCollection, String filterString, Comparator comparator)
|
||||
{
|
||||
Set<ItemStack> nameSortedSet = new TreeSet<ItemStack>(comparator);
|
||||
|
||||
for (ItemStack itemStack : unfilteredCollection)
|
||||
{
|
||||
String itemDisplayName = itemStack.getDisplayName().toLowerCase();
|
||||
|
||||
if (filterString != null)
|
||||
{
|
||||
if (itemDisplayName.contains(filterString.toLowerCase()))
|
||||
{
|
||||
nameSortedSet.add(itemStack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nameSortedSet.add(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
return nameSortedSet;
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> unfilteredCollection, EnergyValue energyValue)
|
||||
{
|
||||
return filterByEnergyValue(unfilteredCollection, energyValue.getValue());
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> unfilteredCollection, EnergyValue energyValue, Comparator<ItemStack> comparator)
|
||||
{
|
||||
return filterByEnergyValue(unfilteredCollection, energyValue.getValue(), comparator);
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> unfilteredCollection, float energyValue)
|
||||
{
|
||||
Set<ItemStack> sortedSet = new HashSet<ItemStack>();
|
||||
|
||||
for (ItemStack itemStack : unfilteredCollection)
|
||||
{
|
||||
if (energyValue > 0f && EnergyValueRegistryProxy.hasEnergyValue(itemStack))
|
||||
{
|
||||
if (EnergyValueRegistryProxy.getEnergyValue(itemStack).getValue() <= energyValue)
|
||||
{
|
||||
sortedSet.add(itemStack);
|
||||
if (filterType == NameFilterType.STARTS_WITH && itemDisplayName.startsWith(filterString.toLowerCase())) {
|
||||
filteredSet.add(itemStack);
|
||||
} else if (filterType == NameFilterType.CONTAINS && itemDisplayName.contains(filterString.toLowerCase())) {
|
||||
filteredSet.add(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sortedSet;
|
||||
return filteredSet;
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> unfilteredCollection, float energyValue, Comparator<ItemStack> comparator)
|
||||
{
|
||||
Set<ItemStack> sortedSet = new TreeSet<ItemStack>(comparator);
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> itemStacks, Number valueBound) {
|
||||
return filterByEnergyValue(itemStacks, new EnergyValue(valueBound.floatValue()), ValueFilterType.VALUE_LOWER_THAN_BOUND, null);
|
||||
}
|
||||
|
||||
for (ItemStack itemStack : unfilteredCollection)
|
||||
{
|
||||
if (energyValue > 0f && EnergyValueRegistryProxy.hasEnergyValue(itemStack))
|
||||
{
|
||||
if (EnergyValueRegistryProxy.getEnergyValue(itemStack).getValue() <= energyValue)
|
||||
{
|
||||
sortedSet.add(itemStack);
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> itemStacks, EnergyValue valueBound) {
|
||||
return filterByEnergyValue(itemStacks, valueBound, ValueFilterType.VALUE_LOWER_THAN_BOUND, null);
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> itemStacks, Number valueBound, ValueFilterType filterType) {
|
||||
return filterByEnergyValue(itemStacks, new EnergyValue(valueBound.floatValue()), filterType, null);
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> itemStacks, EnergyValue valueBound, ValueFilterType filterType) {
|
||||
return filterByEnergyValue(itemStacks, valueBound, filterType, null);
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> itemStacks, Number valueBound, ValueFilterType filterType, Comparator comparator) {
|
||||
return filterByEnergyValue(itemStacks, new EnergyValue(valueBound.floatValue()), filterType, comparator);
|
||||
}
|
||||
|
||||
public static Set<ItemStack> filterByEnergyValue(Collection<ItemStack> itemStacks, EnergyValue valueBound, ValueFilterType filterType, Comparator comparator) {
|
||||
|
||||
Set<ItemStack> filteredSet = (comparator != null ? new TreeSet<>(comparator) : new TreeSet<>(Comparators.displayNameComparator));
|
||||
|
||||
if (itemStacks != null) {
|
||||
|
||||
if (valueBound == null) {
|
||||
filteredSet.addAll(itemStacks);
|
||||
}
|
||||
else {
|
||||
for (ItemStack itemStack : itemStacks) {
|
||||
|
||||
EnergyValue energyValue = EnergyValueRegistryProxy.getEnergyValue(itemStack);
|
||||
|
||||
if (energyValue != null) {
|
||||
if (filterType == ValueFilterType.VALUE_LOWER_THAN_BOUND && energyValue.compareTo(valueBound) <= 0) {
|
||||
filteredSet.add(itemStack);
|
||||
}
|
||||
else if (filterType == ValueFilterType.VALUE_GREATER_THAN_BOUND && energyValue.compareTo(valueBound) >= 0) {
|
||||
filteredSet.add(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sortedSet;
|
||||
return filteredSet;
|
||||
}
|
||||
|
||||
public enum NameFilterType {
|
||||
STARTS_WITH,
|
||||
CONTAINS
|
||||
}
|
||||
|
||||
public enum ValueFilterType {
|
||||
VALUE_GREATER_THAN_BOUND,
|
||||
VALUE_LOWER_THAN_BOUND
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,18 +3,22 @@ package com.pahimar.ee3.util;
|
|||
import com.pahimar.ee3.reference.Comparators;
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemHelper
|
||||
{
|
||||
public static ItemStack cloneItemStack(ItemStack itemStack, int stackSize)
|
||||
{
|
||||
ItemStack clonedItemStack = itemStack.copy();
|
||||
clonedItemStack.stackSize = stackSize;
|
||||
return clonedItemStack;
|
||||
public class ItemHelper {
|
||||
|
||||
public static ItemStack clone(ItemStack itemStack, int stackSize) {
|
||||
|
||||
if (itemStack != null) {
|
||||
ItemStack clonedItemStack = itemStack.copy();
|
||||
clonedItemStack.stackSize = stackSize;
|
||||
return clonedItemStack;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,60 +29,25 @@ public class ItemHelper
|
|||
* @param second The second ItemStack being tested for equality
|
||||
* @return true if the two ItemStacks are equivalent, false otherwise
|
||||
*/
|
||||
public static boolean equals(ItemStack first, ItemStack second)
|
||||
{
|
||||
public static boolean equals(ItemStack first, ItemStack second) {
|
||||
return (Comparators.idComparator.compare(first, second) == 0);
|
||||
}
|
||||
|
||||
public static boolean equalsIgnoreStackSize(ItemStack itemStack1, ItemStack itemStack2)
|
||||
{
|
||||
if (itemStack1 != null && itemStack2 != null)
|
||||
{
|
||||
// Sort on itemID
|
||||
if (Item.getIdFromItem(itemStack1.getItem()) - Item.getIdFromItem(itemStack2.getItem()) == 0)
|
||||
{
|
||||
// Sort on item
|
||||
if (itemStack1.getItem() == itemStack2.getItem())
|
||||
{
|
||||
// Then sort on meta
|
||||
if (itemStack1.getItemDamage() == itemStack2.getItemDamage())
|
||||
{
|
||||
// Then sort on NBT
|
||||
if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound())
|
||||
{
|
||||
// Then sort on stack size
|
||||
if (ItemStack.areItemStackTagsEqual(itemStack1, itemStack2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!itemStack1.hasTagCompound() && !itemStack2.hasTagCompound())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
public static boolean equalsIgnoreStackSize(ItemStack itemStack1, ItemStack itemStack2) {
|
||||
return equals(clone(itemStack1, 1), clone(itemStack2, 1));
|
||||
}
|
||||
|
||||
public static int compare(ItemStack itemStack1, ItemStack itemStack2)
|
||||
{
|
||||
public static int compare(ItemStack itemStack1, ItemStack itemStack2) {
|
||||
return Comparators.idComparator.compare(itemStack1, itemStack2);
|
||||
}
|
||||
|
||||
public static String toString(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
public static String toString(ItemStack itemStack) {
|
||||
|
||||
if (itemStack != null) {
|
||||
if (itemStack.hasTagCompound()) {
|
||||
return String.format("%sxitemStack[%s@%s:%s]", itemStack.stackSize, itemStack.getUnlocalizedName(), itemStack.getItemDamage(), itemStack.getTagCompound());
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
return String.format("%sxitemStack[%s@%s]", itemStack.stackSize, itemStack.getUnlocalizedName(), itemStack.getItemDamage());
|
||||
}
|
||||
}
|
||||
|
@ -86,13 +55,11 @@ public class ItemHelper
|
|||
return "null";
|
||||
}
|
||||
|
||||
public static boolean hasOwner(ItemStack itemStack)
|
||||
{
|
||||
public static boolean hasOwner(ItemStack itemStack) {
|
||||
return (NBTHelper.hasTag(itemStack, Names.NBT.OWNER_UUID_MOST_SIG) && NBTHelper.hasTag(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG)) || NBTHelper.hasTag(itemStack, Names.NBT.OWNER);
|
||||
}
|
||||
|
||||
public static boolean hasOwnerUUID(ItemStack itemStack)
|
||||
{
|
||||
public static boolean hasOwnerUUID(ItemStack itemStack) {
|
||||
return NBTHelper.hasTag(itemStack, Names.NBT.OWNER_UUID_MOST_SIG) && NBTHelper.hasTag(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue