9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-19 14:59:29 +00:00
Files
Gale/gale-server/minecraft-patches/features/0094-Reduce-skull-ItemStack-lookups-for-reduced-visibilit.patch
2025-01-27 12:38:00 -05:00

47 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Wed, 30 Aug 2023 20:17:20 +0200
Subject: [PATCH] Reduce skull ItemStack lookups for reduced visibility
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
This patch is based on the following patch:
"feat: reduce sensor work"
By: peaches94 <peachescu94@gmail.com>
As part of: Petal (https://github.com/Bloom-host/Petal)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
* Petal description *
this patch is focused around the sensors used for ai
delete the line of sight cache less often and use a faster nearby comparison
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index b242b9b6c1f798c2656fa77b1d04e57b2caec5dc..774aa4c2d4d2ba4e9fab6bcca20e7d07bd7fc17f 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1003,15 +1003,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (lookingEntity != null) {
- ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
+ // Gale start - Petal - reduce skull ItemStack lookups for reduced visibility
EntityType<?> type = lookingEntity.getType();
- if (type == EntityType.SKELETON && itemBySlot.is(Items.SKELETON_SKULL)
- || type == EntityType.ZOMBIE && itemBySlot.is(Items.ZOMBIE_HEAD)
- || type == EntityType.PIGLIN && itemBySlot.is(Items.PIGLIN_HEAD)
- || type == EntityType.PIGLIN_BRUTE && itemBySlot.is(Items.PIGLIN_HEAD)
- || type == EntityType.CREEPER && itemBySlot.is(Items.CREEPER_HEAD)) {
+ if (type == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL)
+ || type == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD)
+ || type == EntityType.PIGLIN && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD)
+ || type == EntityType.PIGLIN_BRUTE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD)
+ || type == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) {
d *= 0.5;
}
+ // Gale end - Petal - reduce skull ItemStack lookups for reduced visibility
}
return d;