mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2026-01-06 15:41:56 +00:00
68 lines
3.9 KiB
Diff
68 lines
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Wed, 30 Nov 2022 15:01:42 +0100
|
|
Subject: [PATCH] Ignore durability change equipment updates
|
|
|
|
License: MIT (https://opensource.org/licenses/MIT)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"Ignore durability change equipment updates"
|
|
By: Cryptite <cryptite@gmail.com>
|
|
As part of: Slice (https://github.com/Cryptite/Slice)
|
|
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 25829f5b2675e1eafef5f5a0e40db8a4bbc80ba4..0cc1008b3db93487c8e0801895264683f6d2e439 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3147,7 +3147,7 @@ public abstract class LivingEntity extends Entity {
|
|
}
|
|
|
|
public boolean equipmentHasChanged(ItemStack stack, ItemStack stack2) {
|
|
- return !ItemStack.matches(stack2, stack);
|
|
+ return this.level.galeConfig().smallOptimizations.processFullEquipmentChangeIfOnlyDurabilityChanged ? !ItemStack.matches(stack2, stack) : !ItemStack.isSameIgnoreDurability(stack2, stack); // Gale - Slice - ignore durability change equipment updates
|
|
}
|
|
|
|
private void handleHandSwap(Map<EquipmentSlot, ItemStack> equipmentChanges) {
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index 7626dfea095023343f041e0c5b6d0117873c1236..3cc1096880deea3eb5f50e38f4757455606e28c8 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -721,10 +721,22 @@ public final class ItemStack {
|
|
return left == right ? true : (!left.isEmpty() && !right.isEmpty() ? left.sameItem(right) : false);
|
|
}
|
|
|
|
+ // Gale start - Slice - ignore durability change equipment updates
|
|
+ public static boolean isSameIgnoreDurability(ItemStack left, ItemStack right) {
|
|
+ return left == right ? true : (!left.isEmpty() && !right.isEmpty() ? left.sameItemStackIgnoreDurability(right) : false);
|
|
+ }
|
|
+ // Gale end - Slice - ignore durability change equipment updates
|
|
+
|
|
public boolean sameItem(ItemStack stack) {
|
|
return !stack.isEmpty() && this.is(stack.getItem());
|
|
}
|
|
|
|
+ // Gale start - Slice - ignore durability change equipment updates
|
|
+ public boolean sameItemStackIgnoreDurability(ItemStack stack) {
|
|
+ return !this.isDamageableItem() ? this.sameItem(stack) : !stack.isEmpty() && this.is(stack.getItem());
|
|
+ }
|
|
+ // Gale end - Slice - ignore durability change equipment updates
|
|
+
|
|
public static boolean isSameItemSameTags(ItemStack stack, ItemStack otherStack) {
|
|
return stack.is(otherStack.getItem()) && ItemStack.tagMatches(stack, otherStack);
|
|
}
|
|
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
index 122361057f2b25072ca763df68d614c176c57b5d..72ab895b4b64d224b847ec330512f1aed0b39f6b 100644
|
|
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
@@ -62,6 +62,8 @@ public class GaleWorldConfiguration extends ConfigurationPart {
|
|
public boolean useOptimizedSheepOffspringColor = true;
|
|
// Gale end - carpet-fixes - optimize sheep offspring color
|
|
|
|
+ public boolean processFullEquipmentChangeIfOnlyDurabilityChanged = false; // Gale - Slice - ignore durability change equipment updates
|
|
+
|
|
// Gale start - Airplane - reduce projectile chunk loading
|
|
public MaxProjectileChunkLoads maxProjectileChunkLoads;
|
|
public class MaxProjectileChunkLoads extends ConfigurationPart {
|