9
0
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:
Dreeam
2024-11-30 20:01:54 -05:00
committed by GitHub
parent 714cb8a9cf
commit 0510b51ed3
81 changed files with 23 additions and 2 deletions

View File

@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 31 Oct 2024 20:36:41 -0700
Subject: [PATCH] Paper: Improve performance of RecipeManager#removeRecipe
Original license: GPLv3
Original project: https://github.com/PaperMC/Paper
Paper pull request: https://github.com/PaperMC/Paper/pull/11547
Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
Ported from Paper 1.21.3
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
index de7537c4eacf6fa549f74fd329102a2e4865194a..dea4b6ea87f721e8005640028df7299ef14c23a4 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -230,17 +230,20 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
}
// CraftBukkit start
+ // Leaf start - Paper - replace removeRecipe implementation
public boolean removeRecipe(ResourceLocation mcKey) {
- Iterator<RecipeHolder<?>> iter = this.byType.values().iterator();
- while (iter.hasNext()) {
- RecipeHolder<?> recipe = iter.next();
- if (recipe.id().equals(mcKey)) {
- iter.remove();
- }
+ final RecipeHolder<?> remove = this.byName.remove(mcKey);
+
+ if (remove == null) {
+ return false;
}
- return this.byName.remove(mcKey) != null;
+ final RecipeType<? extends Recipe<?>> type = remove.value().getType();
+ final Collection<RecipeHolder<?>> recipes = (Collection<RecipeHolder<?>>) this.byType((RecipeType) type);
+
+ return recipes.remove(remove);
}
+ // Leaf end - Paper - replace removeRecipe implementation
public void clearRecipes() {
this.byType = LinkedHashMultimap.create();