Skip to content

Commit

Permalink
Don't make name lookups for textured skins
Browse files Browse the repository at this point in the history
99% of time it probably won't matter. If it does, people can manually
specify it (updated meta for that)
  • Loading branch information
Morphan1 committed Apr 2, 2016
1 parent 5c87dd8 commit 7f76c6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ public void adjust(Mechanism mechanism) {
// <--[mechanism]
// @object dItem
// @name skull_skin
// @input Element(|Element)
// @input Element(|Element(|Element))
// @description
// Sets the player skin on a skull_item.
// The first Element is a UUID.
// Optionally, use the second Element for the skin texture cache.
// This will require the player's UUID, not their name.
// Optionally, use the third Element for a player name.
// @tags
// <i@item.skin>
// <i@item.skin.full>
Expand Down Expand Up @@ -170,6 +171,7 @@ public void adjust(Mechanism mechanism) {
}
profile = fillGameProfile(profile);
if (list.size() > 1) { // Ensure we didn't get overwritten
profile.getProperties().get("textures").clear();
profile.getProperties().put("textures", new com.mojang.authlib.properties.Property("value", list.get(1)));
}
NBTTagCompound tag = itemStack.hasTag() ? itemStack.getTag() : new NBTTagCompound();
Expand All @@ -193,8 +195,7 @@ public static GameProfile fillGameProfile(GameProfile gameProfile) {
if (gameProfile1 == null) {
gameProfile1 = gameProfile;
}
if (Iterables.getFirst(gameProfile1.getProperties().get("textures"), null) == null
|| gameProfile1.getName() == null) {
if (Iterables.getFirst(gameProfile1.getProperties().get("textures"), null) == null) {
if (dB.verbose) {
dB.log("Filling profile name/textures!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,10 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

ItemStack itemStack = item.getItemStack();

dB.log("testing");
if (value.asString().equals("")) {
dB.log("removing");
itemStack = CustomNBT.removeCustomNBT(itemStack, key.asString());
}
else {
dB.log("adding");
itemStack = CustomNBT.addCustomNBT(itemStack, key.asString(), value.asString());
}

Expand Down

0 comments on commit 7f76c6f

Please sign in to comment.