9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-26 18:19:11 +00:00

Reduce skull ItemStack lookups for reduced visibility

This commit is contained in:
Martijn Muijsers
2023-08-30 20:21:55 +02:00
parent e2ab191c7a
commit 1248bf7e20
7 changed files with 37 additions and 2 deletions

View File

@@ -29,7 +29,7 @@ index 2868dab7b100d9c325b0e5056f86660d631dec4b..2acad4c3fd58178b0f8b22bdb04eeeeb
}
diff --git a/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java b/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java
new file mode 100644
index 0000000000000000000000000000000000000000..0e9b11940513e96a21bed011afb0b05257782bfc
index 0000000000000000000000000000000000000000..d313213da0498d9229a3ac859513ed985fbfe381
--- /dev/null
+++ b/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java
@@ -0,0 +1,37 @@
@@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..0e9b11940513e96a21bed011afb0b052
+ * The <code>patch</code> version is incremented for small changes that do not affect the goal of any feature,
+ * such as bug fixes, performance improvements or changes in wording.
+ */
+ public static final @NotNull String version = "0.6.8";
+ public static final @NotNull String version = "0.6.9";
+
+ /**
+ * The "<code>major.minor</code>" portion of the {@link #version}.

View File

@@ -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;
}
}