forked from GaleMC/Gale
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce skull ItemStack lookups for reduced visibility
- Loading branch information
1 parent
e2ab191
commit 1248bf7
Showing
7 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
patches/server/0144-Reduce-skull-ItemStack-lookups-for-reduced-visibilit.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
index a35891723fad4fe984566c41cdd728004f8f371e..a30beddd896b8d36c48d442871818327a7e4810d 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
@@ -1023,10 +1023,9 @@ public abstract class LivingEntity extends Entity implements Attackable { | ||
} | ||
|
||
if (entity != null) { | ||
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); | ||
EntityType<?> entitytypes = entity.getType(); | ||
|
||
- if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.PIGLIN && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.PIGLIN_BRUTE && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) { | ||
+ if (entitytypes == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.PIGLIN && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD) || entitytypes == EntityType.PIGLIN_BRUTE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD) || entitytypes == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { // Gale - Petal - reduce skull ItemStack lookups for reduced visibility | ||
d0 *= 0.5D; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.