Move to configurate for paper.yml (#7609)

This commit is contained in:
Jake Potrebic
2022-06-09 01:51:45 -07:00
parent 01cf853f91
commit 2168417373
193 changed files with 4094 additions and 3835 deletions

View File

@@ -4,24 +4,6 @@ Date: Tue, 3 Aug 2021 17:28:27 +0200
Subject: [PATCH] Hide unnecessary itemmeta from clients
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
behaviorTickRates = loadTickRates("behavior");
}
+ public boolean hideItemmetaFromClients = false;
+ public boolean hideDurabilityFromClients = false;
+ private void getHideItemmetaFromClients() {
+ hideItemmetaFromClients = getBoolean("anticheat.obfuscation.items.hide-itemmeta", hideItemmetaFromClients);
+ hideDurabilityFromClients = getBoolean("anticheat.obfuscation.items.hide-durability", hideDurabilityFromClients);
+ }
+
private com.google.common.collect.Table<String, String, Integer> loadTickRates(String type) {
log(" " + type + ":");
com.google.common.collect.Table<String, String, Integer> table = com.google.common.collect.HashBasedTable.create();
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -59,14 +41,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ final ItemStack copy = copyItemStack ? itemStack.copy() : itemStack;
+ if (level.paperConfig.hideDurabilityFromClients) {
+ if (level.paperConfig().anticheat.obfuscation.items.hideDurability) {
+ // Only show damage values for elytra's, since they show a different texture when broken.
+ if (!copy.is(Items.ELYTRA) || copy.getDamageValue() < copy.getMaxDamage() - 1) {
+ copy.setDamageValue(0);
+ }
+ }
+
+ if (level.paperConfig.hideItemmetaFromClients) {
+ if (level.paperConfig().anticheat.obfuscation.items.hideItemmeta) {
+ // Some resource packs show different textures when there is more than one item. Since this shouldn't provide a big advantage,
+ // we'll tell the client if there's one or (more than) two items.
+ copy.setCount(copy.getCount() > 1 ? 2 : 1);