aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2023-05-27 19:21:04 +0200
committerGitHub <noreply@github.com>2023-05-27 19:21:04 +0200
commit813c8d6b20a9c01de27f5d0b5804c4df5dc4044b (patch)
tree706a67563ed65ecb1f96ffec83bb8727854cba28 /src/main/java
parent9cb9f7633dd71515eb972028a580c9e60fe22f89 (diff)
downloadNotEnoughUpdates-813c8d6b20a9c01de27f5d0b5804c4df5dc4044b.tar.gz
NotEnoughUpdates-813c8d6b20a9c01de27f5d0b5804c4df5dc4044b.tar.bz2
NotEnoughUpdates-813c8d6b20a9c01de27f5d0b5804c4df5dc4044b.zip
Add NPC Position only exporter (#686)
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/GUIClientPlayer.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java26
2 files changed, 29 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/GUIClientPlayer.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/GUIClientPlayer.java
index 8cdf2ef0..3311f21d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/GUIClientPlayer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/GUIClientPlayer.java
@@ -32,9 +32,9 @@ public class GUIClientPlayer extends AbstractClientPlayer {
super(null, new GameProfile(UUID.randomUUID(), "GuiPlayer"));
}
- ResourceLocation overrideSkin = DefaultPlayerSkin.getDefaultSkinLegacy();
- ResourceLocation overrideCape = null;
- boolean overrideIsSlim = false;
+ public ResourceLocation overrideSkin = DefaultPlayerSkin.getDefaultSkinLegacy();
+ public ResourceLocation overrideCape = null;
+ public boolean overrideIsSlim = false;
NetworkPlayerInfo playerInfo = new NetworkPlayerInfo(this.getGameProfile()) {
@Override
public String getSkinType() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
index f8f42b80..93ea6127 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.util;
+import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -36,16 +37,34 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
+import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
public class ItemUtils {
+ private static final Gson smallPrintingGson = new Gson();
+
+ public static ItemStack createSkullItemStack(String displayName, String uuid, String skinAbsoluteUrl) {
+ JsonObject object = new JsonObject();
+ JsonObject textures = new JsonObject();
+ JsonObject skin = new JsonObject();
+ skin.addProperty("url", skinAbsoluteUrl);
+ textures.add("SKIN", skin);
+ object.add("textures", textures);
+ String json = smallPrintingGson.toJson(object);
+ return Utils.createSkull(
+ displayName,
+ uuid,
+ Base64.getEncoder().encodeToString(json.getBytes(StandardCharsets.UTF_8))
+ );
+ }
public static ItemStack getCoinItemStack(double coinAmount) {
String uuid = "2070f6cb-f5db-367a-acd0-64d39a7e5d1b";
@@ -187,6 +206,13 @@ public class ItemUtils {
return text;
}
+ public static NBTTagCompound getExtraAttributes(ItemStack itemStack) {
+ NBTTagCompound tag = getOrCreateTag(itemStack);
+ NBTTagCompound extraAttributes = tag.getCompoundTag("ExtraAttributes");
+ tag.setTag("ExtraAttributes", extraAttributes);
+ return extraAttributes;
+ }
+
public static ItemStack createPetItemstackFromPetInfo(PetInfoOverlay.Pet currentPet) {
if (currentPet == null) {
ItemStack stack = ItemUtils.createQuestionMarkSkull(EnumChatFormatting.RED + "Unknown Pet");