mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-31 12:56:29 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939) PaperMC/Paper@1922be90 Update custom tags (#12183) PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009) PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949) PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992) PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974) PaperMC/Paper@42b653b1 Expose more argument types (#12665) PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010) PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996) PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
36 lines
1.6 KiB
Diff
36 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Taiyou06 <kaandindar21@gmail.com>
|
|
Date: Tue, 13 May 2025 20:41:07 +0200
|
|
Subject: [PATCH] Use HashedList on WeightedList
|
|
|
|
|
|
diff --git a/net/minecraft/util/random/WeightedList.java b/net/minecraft/util/random/WeightedList.java
|
|
index daab145028c59c07049a2cf75c4f159e4c5073dc..4bb07ffde3674dc8d09b858ec0bd1ebc8a83bff1 100644
|
|
--- a/net/minecraft/util/random/WeightedList.java
|
|
+++ b/net/minecraft/util/random/WeightedList.java
|
|
@@ -19,6 +19,7 @@ public class WeightedList<E> { // Paper - non-final
|
|
private final List<Weighted<E>> items;
|
|
@Nullable
|
|
private final WeightedList.Selector<E> selector;
|
|
+ private List<Weighted<E>> entryHashList; // Leaf - Use HashedList on WeightedList
|
|
|
|
protected WeightedList(List<? extends Weighted<E>> items) { // Paper - protected
|
|
this.items = List.copyOf(items);
|
|
@@ -30,6 +31,7 @@ public class WeightedList<E> { // Paper - non-final
|
|
} else {
|
|
this.selector = new WeightedList.Compact<>(this.items);
|
|
}
|
|
+ this.entryHashList = this.items.size() > 4 ? this.items : java.util.Collections.unmodifiableList(new org.dreeam.leaf.util.list.HashedReferenceList<>(this.items)); // Leaf - Use HashedList on WeightedList
|
|
}
|
|
|
|
public static <E> WeightedList<E> of() {
|
|
@@ -80,7 +82,7 @@ public class WeightedList<E> { // Paper - non-final
|
|
}
|
|
|
|
public List<Weighted<E>> unwrap() {
|
|
- return this.items;
|
|
+ return this.entryHashList; // Leaf - Use HashedList on WeightedList
|
|
}
|
|
|
|
public static <E> Codec<WeightedList<E>> codec(Codec<E> elementCodec) {
|