Add files via upload
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Fri, 10 Dec 2021 22:26:16 +0100
|
||||
Subject: [PATCH] Always convert Lore/Name of an item to ensure consistency
|
||||
|
||||
Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index f9b7292c2eb2588c9769fcd8f56cc8da5259e7ce..4f115fc79a2d50bad2afa00363d56ec19645d926 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -175,9 +175,9 @@ public final class ItemStack {
|
||||
if (display != null) {
|
||||
if (display.contains("Name", 8)) {
|
||||
String json = display.getString("Name");
|
||||
- if (json != null && json.contains("\u00A7")) {
|
||||
+ if (true || json != null && json.contains("\u00A7")) {
|
||||
try {
|
||||
- display.put("Name", convert(json));
|
||||
+ display.put("Name", convert(json)); // Paper
|
||||
} catch (JsonParseException jsonparseexception) {
|
||||
display.remove("Name");
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public final class ItemStack {
|
||||
ListTag list = display.getList("Lore", 8);
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
String json = list.getString(index);
|
||||
- if (json != null && json.contains("\u00A7")) { // Only try if it has legacy in the unparsed json
|
||||
+ if (true || json != null && json.contains("\u00A7")) { // Only try if it has legacy in the unparsed json // Paper
|
||||
try {
|
||||
list.set(index, convert(json));
|
||||
} catch (JsonParseException e) {
|
||||
@@ -204,6 +204,9 @@ public final class ItemStack {
|
||||
if (component instanceof TextComponent && component.getContents().contains("\u00A7") && component.getSiblings().isEmpty()) {
|
||||
// Only convert if the root component is a single comp with legacy in it, don't convert already normal components
|
||||
component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(component.getContents())[0];
|
||||
+ } else {
|
||||
+ // pass this to legacy format and back to strip invisible components and ensure consistent modifier format
|
||||
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(component))[0];
|
||||
}
|
||||
return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index fcd61bcf69518047fec7d838207e7d36e477f9c7..f9814853bf25fd2049176c5dd0dc1e1b99544f48 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -687,7 +687,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@Overridden
|
||||
void applyToItem(CompoundTag itemTag) {
|
||||
if (this.hasDisplayName()) {
|
||||
- this.setDisplayTag(itemTag, NAME.NBT, StringTag.valueOf(displayName));
|
||||
+ this.setDisplayTag(itemTag, NAME.NBT, StringTag.valueOf(CraftChatMessage.reencode(displayName))); // Paper
|
||||
}
|
||||
if (this.hasLocalizedName()) {
|
||||
this.setDisplayTag(itemTag, LOCNAME.NBT, StringTag.valueOf(locName));
|
||||
@@ -779,7 +779,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
ListTag tagList = new ListTag();
|
||||
for (String value : list) {
|
||||
// SPIGOT-5342 - horrible hack as 0 version does not go through the Mojang updater
|
||||
- tagList.add(StringTag.valueOf(this.version <= 0 || this.version >= 1803 ? value : CraftChatMessage.fromJSONComponent(value))); // SPIGOT-4935
|
||||
+ tagList.add(StringTag.valueOf(this.version <= 0 || this.version >= 1803 ? CraftChatMessage.reencode(value) : CraftChatMessage.fromJSONComponent(value))); // SPIGOT-4935 // Paper
|
||||
}
|
||||
|
||||
return tagList;
|
||||
@@ -882,7 +882,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
// Paper end
|
||||
@Override
|
||||
public final void setDisplayName(String name) {
|
||||
- this.displayName = CraftChatMessage.fromStringOrNullToJSON(name);
|
||||
+ this.displayName = CraftChatMessage.fromStringOrNullToJSON(CraftChatMessage.reencode(name)); // Paper
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -1547,7 +1547,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
if (possiblyJsonInput) {
|
||||
addTo.add(CraftChatMessage.fromJSONOrStringToJSON(entry));
|
||||
} else {
|
||||
- addTo.add(CraftChatMessage.fromStringToJSON(entry));
|
||||
+ addTo.add(CraftChatMessage.fromStringToJSON(CraftChatMessage.reencode(entry)));
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
index 26d43c229caf9f8504af7071c3a61ec6da7e27ec..6e8edc80dd7dfa867901769fda82706746f1bcc5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
@@ -41,6 +41,12 @@ public final class CraftChatMessage {
|
||||
return ChatColor.getByChar(format.code);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static String reencode(String string) {
|
||||
+ return CraftChatMessage.fromComponent(CraftChatMessage.fromString(string)[0]);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
private static final class StringMessage {
|
||||
private static final Pattern INCREMENTAL_PATTERN = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " \\n]|$))))|(\\n)", Pattern.CASE_INSENSITIVE);
|
||||
// Separate pattern with no group 3, new lines are part of previous string
|
||||
21
patches/server/0040-Bound-villager-trade-maxUses-by-16.patch
Normal file
21
patches/server/0040-Bound-villager-trade-maxUses-by-16.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Fri, 10 Dec 2021 22:29:10 +0100
|
||||
Subject: [PATCH] Bound villager trade maxUses by 16
|
||||
|
||||
Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
index 12354b2fd411c57fd14dfca92cd2f1522fa6f050..8a0818aa346fa20414d669a72d42d27458c4a9ba 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
@@ -46,7 +46,7 @@ public class MerchantOffer {
|
||||
this.result = ItemStack.of(nbt.getCompound("sell"));
|
||||
this.uses = nbt.getInt("uses");
|
||||
if (nbt.contains("maxUses", 99)) {
|
||||
- this.maxUses = nbt.getInt("maxUses");
|
||||
+ this.maxUses = Math.min(16, nbt.getInt("maxUses")); // EMC
|
||||
} else {
|
||||
this.maxUses = 4;
|
||||
}
|
||||
46
patches/server/0041-Tweak-Explosions.patch
Normal file
46
patches/server/0041-Tweak-Explosions.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Fri, 10 Dec 2021 22:32:06 +0100
|
||||
Subject: [PATCH] Tweak Explosions
|
||||
|
||||
Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index eebbf0b9d646ee5ae1bd48c821f122a7c4f4a0c6..6775b0363152d8189a0c69d3f21c5b7e2cf9ffe5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -155,6 +155,7 @@ public class Explosion {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
+ if (this.fire || this.blockInteraction != BlockInteraction.NONE) { // EMC - don't run block processing if neither flag is set
|
||||
for (int k = 0; k < 16; ++k) {
|
||||
for (i = 0; i < 16; ++i) {
|
||||
for (j = 0; j < 16; ++j) {
|
||||
@@ -209,6 +210,7 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ } // EMC
|
||||
|
||||
this.toBlow.addAll(set);
|
||||
float f2 = this.radius * 2.0F;
|
||||
@@ -219,7 +221,7 @@ public class Explosion {
|
||||
int i1 = Mth.floor(this.y + (double) f2 + 1.0D);
|
||||
int j1 = Mth.floor(this.z - (double) f2 - 1.0D);
|
||||
int k1 = Mth.floor(this.z + (double) f2 + 1.0D);
|
||||
- List<Entity> list = this.level.getEntities(this.source, new AABB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities
|
||||
+ List<Entity> list = this.level.getEntities(this.source, new AABB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator() && !(entity instanceof ItemEntity)); // Paper - Fix lag from explosions processing dead entitiess // EMC - exclude item entities
|
||||
Vec3 vec3d = new Vec3(this.x, this.y, this.z);
|
||||
|
||||
for (int l1 = 0; l1 < list.size(); ++l1) {
|
||||
@@ -279,7 +281,7 @@ public class Explosion {
|
||||
boolean flag1 = this.blockInteraction != Explosion.BlockInteraction.NONE;
|
||||
|
||||
if (particles) {
|
||||
- if (this.radius >= 2.0F && flag1) {
|
||||
+ if (this.radius >= 2.0F /*&& flag1*/) { // EMC - don't care about block breaks flag for animation
|
||||
this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
this.level.addParticle(ParticleTypes.EXPLOSION, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
||||
Reference in New Issue
Block a user