aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-04-14 03:46:12 +0200
committernea <nea@nea.moe>2023-04-14 03:46:12 +0200
commit893e7262ed05d9266548d899c98dad2e1cb285f1 (patch)
tree785791d06c509c0f1f4070bc7c9e6d4afc8c76b8 /src/main/java
parent100ec81fc2f2af8f19cf034e2130ca7ba2661d4e (diff)
downloadNotEnoughUpdates-893e7262ed05d9266548d899c98dad2e1cb285f1.tar.gz
NotEnoughUpdates-893e7262ed05d9266548d899c98dad2e1cb285f1.tar.bz2
NotEnoughUpdates-893e7262ed05d9266548d899c98dad2e1cb285f1.zip
Add NPC Position only exporter
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");