mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2026-01-04 15:31:45 +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 7a228425a973122de3d0b0e78d18586d6669e9ed..c6488bf509178c54ac95665f96a11cfced87cd34 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3148,7 +3148,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 8fd080110ed4efaf6cb3a2561b32ed66ff8c78f0..b1a01ef0090718923aff4365d8e93c776a5ebae4 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -720,10 +720,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 b480d492d411d33393ac1b2f41bd4d62d232c568..ce94f9a5bc826ce33ee63581ab864b04a8b4526e 100644
|
|
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
@@ -48,6 +48,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 {
|