Finish up the work on the new commands, and lots of other improvements/fixes

This commit is contained in:
pahimar 2015-02-19 22:09:10 -05:00
parent 56c1a56d26
commit 9801cd639a
12 changed files with 157 additions and 61 deletions

View file

@ -84,6 +84,7 @@ public final class EnergyValueRegistryProxy
return null; return null;
} }
public static List getStacksInRange(int start, int finish) public static List getStacksInRange(int start, int finish)
{ {
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish)); return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));

View file

@ -4,15 +4,19 @@ import com.pahimar.ee3.api.EnergyValue;
import com.pahimar.ee3.exchange.EnergyValueRegistry; import com.pahimar.ee3.exchange.EnergyValueRegistry;
import com.pahimar.ee3.exchange.WrappedStack; import com.pahimar.ee3.exchange.WrappedStack;
import com.pahimar.ee3.inventory.ContainerAlchemicalTome; import com.pahimar.ee3.inventory.ContainerAlchemicalTome;
import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.util.IOwnable; import com.pahimar.ee3.util.IOwnable;
import com.pahimar.ee3.util.ItemHelper; import com.pahimar.ee3.util.ItemHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.UsernameCache;
import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.UUID;
/** /**
* Equivalent-Exchange-3 * Equivalent-Exchange-3
@ -54,7 +58,22 @@ public class ItemTooltipEventHandler
if (event.itemStack.getItem() instanceof IOwnable) if (event.itemStack.getItem() instanceof IOwnable)
{ {
event.toolTip.add("Owner: " + ItemHelper.getOwnerName(event.itemStack)); UUID playerUUID = ItemHelper.getOwnerUUID(event.itemStack);
if (playerUUID != null && UsernameCache.containsUUID(playerUUID))
{
event.toolTip.add(StatCollector.translateToLocalFormatted(Messages.ITEM_BELONGS_TO, UsernameCache.getLastKnownUsername(playerUUID)));
}
else if (ItemHelper.hasOwnerName(event.itemStack))
{
event.toolTip.add(StatCollector.translateToLocalFormatted(Messages.ITEM_BELONGS_TO, ItemHelper.getOwnerName(event.itemStack)));
}
else
{
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))
{
event.toolTip.add(StatCollector.translateToLocal(Messages.ITEM_BELONGS_TO_NO_ONE));
}
}
} }
} }
} }

View file

@ -1,9 +1,13 @@
package com.pahimar.ee3.command; package com.pahimar.ee3.command;
import com.pahimar.ee3.knowledge.TransmutationKnowledgeRegistry;
import com.pahimar.ee3.reference.Messages; import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import net.minecraft.command.CommandBase; import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class CommandTemplateForgetCurrentItem extends CommandBase public class CommandTemplateForgetCurrentItem extends CommandBase
{ {
@ -28,6 +32,23 @@ public class CommandTemplateForgetCurrentItem extends CommandBase
@Override @Override
public void processCommand(ICommandSender commandSender, String[] args) public void processCommand(ICommandSender commandSender, String[] args)
{ {
if (args.length < 1)
{
throw new WrongUsageException(Messages.Commands.TEMPLATE_FORGET_CURRENT_ITEM_USAGE);
}
else
{
ItemStack itemStack = ((EntityPlayer) commandSender).getCurrentEquippedItem();
if (itemStack != null)
{
TransmutationKnowledgeRegistry.getInstance().makeTemplateForget(itemStack);
func_152373_a(commandSender, this, Messages.Commands.TEMPLATE_FORGET_CURRENT_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), itemStack.func_151000_E()});
}
else
{
throw new WrongUsageException(Messages.Commands.NO_ITEM);
}
}
} }
} }

View file

@ -1,9 +1,13 @@
package com.pahimar.ee3.command; package com.pahimar.ee3.command;
import com.pahimar.ee3.knowledge.TransmutationKnowledgeRegistry;
import com.pahimar.ee3.reference.Messages; import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import net.minecraft.command.CommandBase; import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class CommandTemplateLearnCurrentItem extends CommandBase public class CommandTemplateLearnCurrentItem extends CommandBase
{ {
@ -28,6 +32,23 @@ public class CommandTemplateLearnCurrentItem extends CommandBase
@Override @Override
public void processCommand(ICommandSender commandSender, String[] args) public void processCommand(ICommandSender commandSender, String[] args)
{ {
if (args.length < 1)
{
throw new WrongUsageException(Messages.Commands.TEMPLATE_LEARN_CURRENT_ITEM_USAGE);
}
else
{
ItemStack itemStack = ((EntityPlayer) commandSender).getCurrentEquippedItem();
if (itemStack != null)
{
TransmutationKnowledgeRegistry.getInstance().teachTemplate(itemStack);
func_152373_a(commandSender, this, Messages.Commands.TEMPLATE_LEARN_CURRENT_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), itemStack.func_151000_E()});
}
else
{
throw new WrongUsageException(Messages.Commands.NO_ITEM);
}
}
} }
} }

View file

@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableSortedMap;
import com.google.gson.*; import com.google.gson.*;
import com.pahimar.ee3.api.EnergyValue; import com.pahimar.ee3.api.EnergyValue;
import com.pahimar.ee3.api.IEnergyValueProvider; import com.pahimar.ee3.api.IEnergyValueProvider;
import com.pahimar.ee3.knowledge.AbilityRegistry;
import com.pahimar.ee3.recipe.RecipeRegistry; import com.pahimar.ee3.recipe.RecipeRegistry;
import com.pahimar.ee3.reference.Files; import com.pahimar.ee3.reference.Files;
import com.pahimar.ee3.reference.Reference; import com.pahimar.ee3.reference.Reference;
@ -239,9 +240,11 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer<EnergyV
{ {
WrappedStack stack = new WrappedStack(object); WrappedStack stack = new WrappedStack(object);
if (stack.getWrappedStack() instanceof ItemStack && ((ItemStack) stack.getWrappedStack()).getItem() instanceof IEnergyValueProvider) if (stack.getWrappedStack() instanceof ItemStack && ((ItemStack) stack.getWrappedStack()).getItem() instanceof IEnergyValueProvider && !strict)
{ {
EnergyValue energyValue = ((IEnergyValueProvider) ((ItemStack) stack.getWrappedStack()).getItem()).getEnergyValue((ItemStack) stack.getWrappedStack()); ItemStack itemStack = (ItemStack) stack.getWrappedStack();
IEnergyValueProvider iEnergyValueProvider = (IEnergyValueProvider) itemStack.getItem();
EnergyValue energyValue = iEnergyValueProvider.getEnergyValue(itemStack);
if (energyValue != null && energyValue.getEnergyValue() > 0f) if (energyValue != null && energyValue.getEnergyValue() > 0f)
{ {
@ -359,7 +362,7 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer<EnergyV
{ {
runDynamicEnergyValueResolution(); runDynamicEnergyValueResolution();
} }
determineAllItemStacksWithValues(); AbilityRegistry.getInstance().discoverAllLearnableItemStacks();
this.shouldRegenNextRestart = false; this.shouldRegenNextRestart = false;
} }
@ -478,30 +481,6 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer<EnergyV
saveEnergyValueRegistryToFile(); saveEnergyValueRegistryToFile();
} }
private void determineAllItemStacksWithValues()
{
this.allItemStacksWithValues = new TreeSet<ItemStack>(ItemHelper.baseComparator);
for (WrappedStack wrappedStack : this.stackMappings.keySet())
{
if (wrappedStack.getWrappedStack() instanceof OreStack)
{
for (ItemStack itemStack : OreDictionary.getOres(((OreStack) wrappedStack.getWrappedStack()).oreName))
{
this.allItemStacksWithValues.add(itemStack);
}
}
else if (wrappedStack.getWrappedStack() instanceof ItemStack)
{
this.allItemStacksWithValues.add((ItemStack) wrappedStack.getWrappedStack());
}
}
}
public Set<ItemStack> getAllItemStacksWithValues()
{
return this.allItemStacksWithValues;
}
private void generateValueStackMappings() private void generateValueStackMappings()
{ {
SortedMap<EnergyValue, List<WrappedStack>> tempValueMappings = new TreeMap<EnergyValue, List<WrappedStack>>(); SortedMap<EnergyValue, List<WrappedStack>> tempValueMappings = new TreeMap<EnergyValue, List<WrappedStack>>();
@ -736,6 +715,16 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer<EnergyV
this.shouldRegenNextRestart = shouldRegenNextRestart; this.shouldRegenNextRestart = shouldRegenNextRestart;
} }
public ImmutableSortedMap<WrappedStack, EnergyValue> getStackValueMap()
{
return stackMappings;
}
public ImmutableSortedMap<EnergyValue, List<WrappedStack>> getValueStackMap()
{
return valueMappings;
}
public void saveEnergyValueRegistryToFile() public void saveEnergyValueRegistryToFile()
{ {
File energyValuesDataDirectory = new File(FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld().getSaveHandler().getWorldDirectory(), "data" + File.separator + Reference.LOWERCASE_MOD_ID + File.separator + "energyvalues"); File energyValuesDataDirectory = new File(FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld().getSaveHandler().getWorldDirectory(), "data" + File.separator + Reference.LOWERCASE_MOD_ID + File.separator + "energyvalues");

View file

@ -1,10 +1,7 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.reference.Colors; import com.pahimar.ee3.reference.*;
import com.pahimar.ee3.reference.GUIs;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.util.ColorHelper; import com.pahimar.ee3.util.ColorHelper;
import com.pahimar.ee3.util.IOwnable; import com.pahimar.ee3.util.IOwnable;
import com.pahimar.ee3.util.ItemHelper; import com.pahimar.ee3.util.ItemHelper;
@ -17,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -97,10 +95,10 @@ public class ItemAlchemicalBag extends ItemEE implements IOwnable
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
// Set the owner if (!ItemHelper.hasOwnerUUID(itemStack))
if (!ItemHelper.hasOwner(itemStack))
{ {
ItemHelper.setOwner(itemStack, entityPlayer); ItemHelper.setOwner(itemStack, entityPlayer);
entityPlayer.addChatComponentMessage(new ChatComponentTranslation(Messages.OWNER_SET_TO_SELF, new Object[]{itemStack.func_151000_E()}));
} }
// Set a UUID on the Alchemical Bag, if one doesn't exist already // Set a UUID on the Alchemical Bag, if one doesn't exist already

View file

@ -1,6 +1,10 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.api.EnergyValue;
import com.pahimar.ee3.api.EnergyValueRegistryProxy;
import com.pahimar.ee3.api.IEnergyValueProvider;
import com.pahimar.ee3.init.ModItems;
import com.pahimar.ee3.reference.GUIs; import com.pahimar.ee3.reference.GUIs;
import com.pahimar.ee3.reference.Messages; import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
@ -11,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemAlchemicalTome extends ItemEE implements IOwnable public class ItemAlchemicalTome extends ItemEE implements IOwnable, IEnergyValueProvider
{ {
public ItemAlchemicalTome() public ItemAlchemicalTome()
{ {
@ -30,8 +34,7 @@ public class ItemAlchemicalTome extends ItemEE implements IOwnable
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
// Set the owner if one hasn't been set already if (!ItemHelper.hasOwnerUUID(itemStack))
if (!ItemHelper.hasOwner(itemStack))
{ {
ItemHelper.setOwner(itemStack, entityPlayer); ItemHelper.setOwner(itemStack, entityPlayer);
entityPlayer.addChatComponentMessage(new ChatComponentTranslation(Messages.OWNER_SET_TO_SELF, new Object[]{itemStack.func_151000_E()})); entityPlayer.addChatComponentMessage(new ChatComponentTranslation(Messages.OWNER_SET_TO_SELF, new Object[]{itemStack.func_151000_E()}));
@ -44,4 +47,10 @@ public class ItemAlchemicalTome extends ItemEE implements IOwnable
return itemStack; return itemStack;
} }
@Override
public EnergyValue getEnergyValue(ItemStack itemStack)
{
return EnergyValueRegistryProxy.getEnergyValue(ModItems.alchemicalTome, true);
}
} }

View file

@ -4,14 +4,19 @@ import com.google.gson.*;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter; import com.google.gson.stream.JsonWriter;
import com.pahimar.ee3.exchange.EnergyValueRegistry; import com.pahimar.ee3.exchange.EnergyValueRegistry;
import com.pahimar.ee3.exchange.OreStack;
import com.pahimar.ee3.exchange.WrappedStack; import com.pahimar.ee3.exchange.WrappedStack;
import com.pahimar.ee3.reference.Files; import com.pahimar.ee3.reference.Files;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.SerializationHelper; import com.pahimar.ee3.util.SerializationHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.io.*; import java.io.*;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDeserializer<AbilityRegistry> public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDeserializer<AbilityRegistry>
@ -23,6 +28,7 @@ public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDes
private boolean hasBeenModified; private boolean hasBeenModified;
private Set<WrappedStack> notLearnableSet; private Set<WrappedStack> notLearnableSet;
private Set<WrappedStack> notRecoverableSet; private Set<WrappedStack> notRecoverableSet;
private SortedSet<ItemStack> allLearnableItemStacks = new TreeSet<ItemStack>(ItemHelper.baseComparator);
private AbilityRegistry() private AbilityRegistry()
{ {
@ -48,6 +54,33 @@ public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDes
notRecoverableSet = new TreeSet<WrappedStack>(); notRecoverableSet = new TreeSet<WrappedStack>();
} }
public void discoverAllLearnableItemStacks()
{
this.allLearnableItemStacks = new TreeSet<ItemStack>(ItemHelper.baseComparator);
for (WrappedStack wrappedStack : EnergyValueRegistry.getInstance().getStackValueMap().keySet())
{
if (isLearnable(wrappedStack))
{
if (wrappedStack.getWrappedStack() instanceof OreStack)
{
for (ItemStack itemStack : OreDictionary.getOres(((OreStack) wrappedStack.getWrappedStack()).oreName))
{
this.allLearnableItemStacks.add(itemStack);
}
}
else if (wrappedStack.getWrappedStack() instanceof ItemStack)
{
this.allLearnableItemStacks.add((ItemStack) wrappedStack.getWrappedStack());
}
}
}
}
public SortedSet<ItemStack> getAllLearnableItemStacks()
{
return allLearnableItemStacks;
}
public Set<WrappedStack> getNotLearnableStacks() public Set<WrappedStack> getNotLearnableStacks()
{ {
return this.notLearnableSet; return this.notLearnableSet;

View file

@ -3,7 +3,6 @@ package com.pahimar.ee3.knowledge;
import com.google.gson.*; import com.google.gson.*;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter; import com.google.gson.stream.JsonWriter;
import com.pahimar.ee3.exchange.EnergyValueRegistry;
import com.pahimar.ee3.exchange.JsonItemStack; import com.pahimar.ee3.exchange.JsonItemStack;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.util.INBTTaggable; import com.pahimar.ee3.util.INBTTaggable;
@ -84,7 +83,7 @@ public class TransmutationKnowledge implements INBTTaggable, JsonSerializer<Tran
{ {
if (canTransmuteEverything) if (canTransmuteEverything)
{ {
return EnergyValueRegistry.getInstance().getAllItemStacksWithValues(); return AbilityRegistry.getInstance().getAllLearnableItemStacks();
} }
else else
{ {
@ -134,26 +133,12 @@ public class TransmutationKnowledge implements INBTTaggable, JsonSerializer<Tran
public Set<ItemStack> filterByNameStartsWith(String filterString) public Set<ItemStack> filterByNameStartsWith(String filterString)
{ {
if (canTransmuteEverything) return ItemHelper.filterByNameStartsWith(getKnownTransmutations(), filterString);
{
return ItemHelper.filterByNameStartsWith(EnergyValueRegistry.getInstance().getAllItemStacksWithValues(), filterString);
}
else
{
return ItemHelper.filterByNameStartsWith(knownTransmutations, filterString);
}
} }
public Set<ItemStack> filterByNameContains(String filterString) public Set<ItemStack> filterByNameContains(String filterString)
{ {
if (canTransmuteEverything) return ItemHelper.filterByNameContains(getKnownTransmutations(), filterString);
{
return ItemHelper.filterByNameContains(EnergyValueRegistry.getInstance().getAllItemStacksWithValues(), filterString);
}
else
{
return ItemHelper.filterByNameContains(knownTransmutations, filterString);
}
} }
@Override @Override

View file

@ -3,7 +3,8 @@ package com.pahimar.ee3.reference;
public final class Messages public final class Messages
{ {
public static final String UPGRADES_CHESTS = "tooltip.ee3:upgradesPrefix"; public static final String UPGRADES_CHESTS = "tooltip.ee3:upgradesPrefix";
public static final String NO_OWNER = "tooltip.ee3:none"; public static final String ITEM_BELONGS_TO = "tooltip.ee3:belongsTo";
public static final String ITEM_BELONGS_TO_NO_ONE = "tooltip.ee3:belongsToNoOne";
public static final String OWNER_SET_TO_SELF = "misc.ee3:owner-set-to-self"; public static final String OWNER_SET_TO_SELF = "misc.ee3:owner-set-to-self";

View file

@ -1,11 +1,9 @@
package com.pahimar.ee3.util; package com.pahimar.ee3.util;
import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import java.util.Comparator; import java.util.Comparator;
@ -279,6 +277,16 @@ public class ItemHelper
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); 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)
{
return NBTHelper.hasTag(itemStack, Names.NBT.OWNER_UUID_MOST_SIG) && NBTHelper.hasTag(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG);
}
public static boolean hasOwnerName(ItemStack itemStack)
{
return NBTHelper.hasTag(itemStack, Names.NBT.OWNER);
}
public static String getOwnerName(ItemStack itemStack) public static String getOwnerName(ItemStack itemStack)
{ {
if (NBTHelper.hasTag(itemStack, Names.NBT.OWNER)) if (NBTHelper.hasTag(itemStack, Names.NBT.OWNER))
@ -286,7 +294,7 @@ public class ItemHelper
return NBTHelper.getString(itemStack, Names.NBT.OWNER); return NBTHelper.getString(itemStack, Names.NBT.OWNER);
} }
return StatCollector.translateToLocal(Messages.NO_OWNER); return null;
} }
public static UUID getOwnerUUID(ItemStack itemStack) public static UUID getOwnerUUID(ItemStack itemStack)
@ -301,8 +309,18 @@ public class ItemHelper
public static void setOwner(ItemStack itemStack, EntityPlayer entityPlayer) public static void setOwner(ItemStack itemStack, EntityPlayer entityPlayer)
{ {
NBTHelper.setString(itemStack, Names.NBT.OWNER, entityPlayer.getDisplayName()); setOwnerName(itemStack, entityPlayer);
setOwnerUUID(itemStack, entityPlayer);
}
public static void setOwnerUUID(ItemStack itemStack, EntityPlayer entityPlayer)
{
NBTHelper.setLong(itemStack, Names.NBT.OWNER_UUID_MOST_SIG, entityPlayer.getUniqueID().getMostSignificantBits()); NBTHelper.setLong(itemStack, Names.NBT.OWNER_UUID_MOST_SIG, entityPlayer.getUniqueID().getMostSignificantBits());
NBTHelper.setLong(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG, entityPlayer.getUniqueID().getLeastSignificantBits()); NBTHelper.setLong(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG, entityPlayer.getUniqueID().getLeastSignificantBits());
} }
public static void setOwnerName(ItemStack itemStack, EntityPlayer entityPlayer)
{
NBTHelper.setString(itemStack, Names.NBT.OWNER, entityPlayer.getDisplayName());
}
} }

View file

@ -147,11 +147,12 @@ commands.ee3.set-item-not-recoverable.usage=/ee3 set-item-not-recoverable <item>
commands.ee3.set-item-not-recoverable.success=%s set %s as not being able to have its energy value recovered commands.ee3.set-item-not-recoverable.success=%s set %s as not being able to have its energy value recovered
# Tooltips # Tooltips
tooltip.ee3:belongsTo=Belongs to %s
tooltip.ee3:belongsToNoOne=Belongs to no one
tooltip.ee3:upgradesPrefix=Upgrades (Alchemical) Chests tooltip.ee3:upgradesPrefix=Upgrades (Alchemical) Chests
tooltip.ee3:alchemicalChestPrefix.small=Small tooltip.ee3:alchemicalChestPrefix.small=Small
tooltip.ee3:alchemicalChestPrefix.medium=Medium tooltip.ee3:alchemicalChestPrefix.medium=Medium
tooltip.ee3:alchemicalChestPrefix.large=Large tooltip.ee3:alchemicalChestPrefix.large=Large
tooltip.ee3:none=None
#Misc #Misc
misc.ee3:owner-set-to-self=You are now the owner of %s misc.ee3:owner-set-to-self=You are now the owner of %s