mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 821ce25d9 Significantly improve performance of the end generation 2b2e4fd65 Add Wandering Trader spawn rate config options 7263cbca7 [CI-SKIP] [Auto] Rebuild Patches 1c63aff6d Villager resetOffers API 8d8d74a5f Patch 2 references an invalid variable e6d7bdca1 [CI-SKIP] fixed sed -i for bsd sed (#4782) 7ae47d4eb [CI-SKIP] Remove Waving banner fix (#4786)
53 lines
2.8 KiB
Diff
53 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Tue, 4 Aug 2020 22:08:23 -0500
|
|
Subject: [PATCH] Allow anvil colors
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
|
index 4aa6b035a..5e4e59e5c 100644
|
|
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
|
|
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
|
@@ -251,6 +251,25 @@ public class ContainerAnvil extends ContainerAnvilAbstract {
|
|
} else if (!this.renameText.equals(itemstack.getName().getString())) {
|
|
b1 = 1;
|
|
i += b1;
|
|
+ // Purpur start
|
|
+ if (player != null && player.world.purpurConfig.anvilAllowColors && player.getBukkitEntity().hasPermission("purpur.anvil.color")) {
|
|
+ String json = "";
|
|
+ try {
|
|
+ String coloredText = net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', this.renameText);
|
|
+ net.md_5.bungee.api.chat.BaseComponent[] bungeeComp = net.md_5.bungee.api.chat.TextComponent.fromLegacyText(coloredText);
|
|
+ json = net.md_5.bungee.chat.ComponentSerializer.toString(bungeeComp);
|
|
+ IChatBaseComponent nmsComp = IChatBaseComponent.ChatSerializer.jsonToComponent(json);
|
|
+ itemstack1.a(nmsComp);
|
|
+ } catch (Exception e) {
|
|
+ MinecraftServer.LOGGER.warn("There was a problem processing item name json component on anvil!");
|
|
+ MinecraftServer.LOGGER.warn("We have fallen back to legacy colorless item name to prevent real errors");
|
|
+ MinecraftServer.LOGGER.warn("Please report this to Purpur!");
|
|
+ MinecraftServer.LOGGER.warn("JSON: " + json);
|
|
+ MinecraftServer.LOGGER.warn("The following error describes what went wrong:");
|
|
+ e.printStackTrace();
|
|
+ }
|
|
+ } else
|
|
+ // Purpur end
|
|
itemstack1.a((IChatBaseComponent) (new ChatComponentText(this.renameText)));
|
|
}
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 5fa74566f..21b8e004c 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -220,6 +220,11 @@ public class PurpurWorldConfig {
|
|
});
|
|
}
|
|
|
|
+ public boolean anvilAllowColors = false;
|
|
+ private void anvilSettings() {
|
|
+ anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|
|
+ }
|
|
+
|
|
public int bambooMaxHeight = 16;
|
|
public int bambooSmallHeight = 10;
|
|
private void bambooSettings() {
|