mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 08:59:23 +00:00
Fix terminal color on Windows (#176)
* Fix terminal color on Windows Windows doesn't have environment variables TERM and COLORTERM by default, but we assuming that it supports the `truecolor` for terminal. * Add back revert to original java console on Java 22
This commit is contained in:
31
patches/server/0098-Remove-stream-in-GolemSensor.patch
Normal file
31
patches/server/0098-Remove-stream-in-GolemSensor.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
||||
Date: Tue, 9 Nov 2077 00:00:00 +0800
|
||||
Subject: [PATCH] Remove stream in GolemSensor
|
||||
|
||||
Stream operations in GolemSensor is really expensive and takes
|
||||
up 80% time per method call.
|
||||
Before: 192ms
|
||||
After: 17ms
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/GolemSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/GolemSensor.java
|
||||
index 94d730e2d8159184a95da4b23266bf2e330be707..f78a342270104ca1082ea535d1152541d7297d8c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/GolemSensor.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/GolemSensor.java
|
||||
@@ -34,7 +34,15 @@ public class GolemSensor extends Sensor<LivingEntity> {
|
||||
public static void checkForNearbyGolem(LivingEntity entity) {
|
||||
Optional<List<LivingEntity>> optional = entity.getBrain().getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES);
|
||||
if (!optional.isEmpty()) {
|
||||
- boolean bl = optional.get().stream().anyMatch(livingEntity -> livingEntity.getType().equals(EntityType.IRON_GOLEM));
|
||||
+ // Leaf start - Remove stream in GolemSensor
|
||||
+ boolean bl = false;
|
||||
+ for (LivingEntity livingEntity : optional.get()) {
|
||||
+ if (livingEntity.getType().equals(EntityType.IRON_GOLEM)) {
|
||||
+ bl = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaf end - Remove stream in GolemSensor
|
||||
if (bl) {
|
||||
golemDetected(entity);
|
||||
}
|
||||
Reference in New Issue
Block a user