Move to configurate for paper.yml (#7609)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user