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:
36
patches/server/0095-Remove-stream-in-BehaviorUtils.patch
Normal file
36
patches/server/0095-Remove-stream-in-BehaviorUtils.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
||||
Date: Sat, 26 Oct 2024 00:56:24 +0800
|
||||
Subject: [PATCH] Remove stream in BehaviorUtils
|
||||
|
||||
Dreeam TODO: Check this
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
||||
index 25dacd924f182d197bcbdcd7c1d8caa482fd8d37..3f8a90e3fab1ace796d2433b90a2472a7a143968 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
||||
@@ -121,12 +121,20 @@ public class BehaviorUtils {
|
||||
|
||||
public static SectionPos findSectionClosestToVillage(ServerLevel world, SectionPos center, int radius) {
|
||||
int j = world.sectionsToVillage(center);
|
||||
- Stream<SectionPos> stream = SectionPos.cube(center, radius).filter((sectionposition1) -> { // CraftBukkit - decompile error
|
||||
- return world.sectionsToVillage(sectionposition1) < j;
|
||||
- });
|
||||
+ // Leaf start - Remove stream in BehaviorUtils
|
||||
+ SectionPos closestSection = center;
|
||||
+ int closestDistance = j;
|
||||
|
||||
Objects.requireNonNull(world);
|
||||
- return (SectionPos) stream.min(Comparator.comparingInt(world::sectionsToVillage)).orElse(center);
|
||||
+ for (SectionPos sectionPosition : SectionPos.cube(center, radius).toList()) {
|
||||
+ int distance = world.sectionsToVillage(sectionPosition);
|
||||
+ if (distance < closestDistance) {
|
||||
+ closestDistance = distance;
|
||||
+ closestSection = sectionPosition;
|
||||
+ }
|
||||
+ }
|
||||
+ return closestSection;
|
||||
+ // Leaf end - Remove stream in BehaviorUtils
|
||||
}
|
||||
|
||||
public static boolean isWithinAttackRange(Mob mob, LivingEntity target, int rangedWeaponReachReduction) {
|
||||
Reference in New Issue
Block a user