remove some more obf helpers
This commit is contained in:
@@ -637,7 +637,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ public static net.minecraft.network.chat.Component asVanilla(final Component component) {
|
||||
+ if (true) return new AdventureComponent(component);
|
||||
+ return net.minecraft.network.chat.Component.Serializer.fromJsonTree(GSON.serializer().toJsonTree(component));
|
||||
+ return net.minecraft.network.chat.Component.Serializer.fromJson(GSON.serializer().toJsonTree(component));
|
||||
+ }
|
||||
+
|
||||
+ public static List<net.minecraft.network.chat.Component> asVanilla(final List<Component> adventures) {
|
||||
@@ -664,7 +664,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (component instanceof AdventureComponent) {
|
||||
+ return asJsonString(((AdventureComponent) component).wrapped, locale);
|
||||
+ }
|
||||
+ return net.minecraft.network.chat.Component.Serializer.componentToJson(component);
|
||||
+ return net.minecraft.network.chat.Component.Serializer.toJson(component);
|
||||
+ }
|
||||
+
|
||||
+ // thank you for being worse than wet socks, Bukkit
|
||||
@@ -759,7 +759,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ tag.putString("author", asJsonString(book.author(), locale));
|
||||
+ final ListTag pages = new ListTag();
|
||||
+ for (final Component page : book.pages()) {
|
||||
+ pages.add(StringTag.create(asJsonString(page, locale)));
|
||||
+ pages.add(StringTag.valueOf(asJsonString(page, locale)));
|
||||
+ }
|
||||
+ tag.put("pages", pages);
|
||||
+ return item;
|
||||
@@ -897,7 +897,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.network.chat.Component serialize(final Component component) {
|
||||
+ return net.minecraft.network.chat.Component.Serializer.fromJsonTree(PaperAdventure.GSON.serializer().toJsonTree(component));
|
||||
+ return net.minecraft.network.chat.Component.Serializer.fromJson(PaperAdventure.GSON.serializer().toJsonTree(component));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java b/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java
|
||||
@@ -946,14 +946,6 @@ diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/ChatFormatting.java
|
||||
+++ b/src/main/java/net/minecraft/ChatFormatting.java
|
||||
@@ -0,0 +0,0 @@ public enum ChatFormatting {
|
||||
return !this.isFormat && this != RESET;
|
||||
}
|
||||
|
||||
+ @Nullable public Integer getHexValue() { return this.getColor(); } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
public Integer getColor() {
|
||||
return this.color;
|
||||
@@ -0,0 +0,0 @@ public enum ChatFormatting {
|
||||
return name == null ? null : FORMATTING_BY_NAME.get(cleanName(name));
|
||||
}
|
||||
@@ -961,7 +953,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper start
|
||||
+ @Nullable public static ChatFormatting getByHexValue(int i) {
|
||||
+ for (ChatFormatting value : values()) {
|
||||
+ if (value.getHexValue() != null && value.getHexValue() == i) {
|
||||
+ if (value.getColor() != null && value.getColor() == i) {
|
||||
+ return value;
|
||||
+ }
|
||||
+ }
|
||||
@@ -973,18 +965,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Nullable
|
||||
public static ChatFormatting getById(int colorIndex) {
|
||||
if (colorIndex < 0) {
|
||||
diff --git a/src/main/java/net/minecraft/nbt/StringTag.java b/src/main/java/net/minecraft/nbt/StringTag.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/StringTag.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/StringTag.java
|
||||
@@ -0,0 +0,0 @@ public class StringTag implements Tag {
|
||||
this.data = value;
|
||||
}
|
||||
|
||||
+ public static StringTag create(final String value) { return valueOf(value); } // Paper - OBFHELPER
|
||||
public static StringTag valueOf(String value) {
|
||||
return value.isEmpty() ? EMPTY : new StringTag(value);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -1070,22 +1050,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
JsonObject jsonobject = new JsonObject();
|
||||
|
||||
if (!ichatbasecomponent.getStyle().isEmpty()) {
|
||||
@@ -0,0 +0,0 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||
});
|
||||
}
|
||||
|
||||
+ public static String componentToJson(final Component component) { return toJson(component); } // Paper - OBFHELPER
|
||||
public static String toJson(Component text) {
|
||||
return Component.Serializer.GSON.toJson(text);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||
return (MutableComponent) GsonHelper.fromJson(Component.Serializer.GSON, json, MutableComponent.class, false);
|
||||
}
|
||||
|
||||
+ public static @Nullable Component fromJsonTree(final JsonElement json) { return fromJson(json); } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
public static MutableComponent fromJson(JsonElement json) {
|
||||
return (MutableComponent) Component.Serializer.GSON.fromJson(json, MutableComponent.class);
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
||||
@@ -1601,18 +1565,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public BossEvent(UUID uuid, Component name, BossEvent.BossBarColor color, BossEvent.BossBarOverlay style) {
|
||||
this.id = uuid;
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ public Component displayName() { return this.getDisplayName(); } // Paper - OBFHELPER
|
||||
public Component getDisplayName() {
|
||||
MutableComponent ichatmutablecomponent = (new TextComponent("")).append(this.getHoverName());
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java
|
||||
@@ -2575,7 +2527,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component displayName(@org.jetbrains.annotations.NotNull ItemStack itemStack) {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).displayName());
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
@@ -3120,8 +3072,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.format.TextColor color() throws IllegalStateException {
|
||||
+ CraftScoreboard scoreboard = checkState();
|
||||
+ if (team.getColor().getHexValue() == null) throw new IllegalStateException("Team colors must have hex values");
|
||||
+ net.kyori.adventure.text.format.TextColor color = net.kyori.adventure.text.format.TextColor.color(team.getColor().getHexValue());
|
||||
+ if (team.getColor().getColor() == null) throw new IllegalStateException("Team colors must have hex values");
|
||||
+ net.kyori.adventure.text.format.TextColor color = net.kyori.adventure.text.format.TextColor.color(team.getColor().getColor());
|
||||
+ if (!(color instanceof net.kyori.adventure.text.format.NamedTextColor)) throw new IllegalStateException("Team doesn't have a NamedTextColor");
|
||||
+ return (net.kyori.adventure.text.format.NamedTextColor) color;
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user