mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-08 08:02:13 -07:00
add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta (#10245)
The existing method with PotionEffect suggests that all attributes are used. In fact, only the PotionEffectType and the duration are used. --------- Co-authored-by: Bjarne Koll <git@lynxplay.dev>
This commit is contained in:
@@ -3488,6 +3488,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.util;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
+import io.papermc.paper.math.BlockPosition;
|
||||
+import io.papermc.paper.math.FinePosition;
|
||||
@@ -3509,6 +3510,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.craftbukkit.util.Waitable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.spigotmc.AsyncCatcher;
|
||||
+
|
||||
+import javax.annotation.Nonnull;
|
||||
@@ -3524,6 +3526,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import java.util.concurrent.atomic.AtomicBoolean;
|
||||
+import java.util.function.BiConsumer;
|
||||
+import java.util.function.Consumer;
|
||||
+import java.util.function.Predicate;
|
||||
+import java.util.function.Supplier;
|
||||
+
|
||||
+public final class MCUtil {
|
||||
@@ -4013,6 +4016,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public static int getTicketLevelFor(net.minecraft.world.level.chunk.ChunkStatus status) {
|
||||
+ return net.minecraft.server.level.ChunkMap.MAX_VIEW_DISTANCE + net.minecraft.world.level.chunk.ChunkStatus.getDistance(status);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static <T> List<T> copyListAndAdd(@NotNull final List<T> original,
|
||||
+ @NotNull final T newElement) {
|
||||
+ return ImmutableList.<T>builderWithExpectedSize(original.size() + 1)
|
||||
+ .addAll(original)
|
||||
+ .add(newElement)
|
||||
+ .build();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static <T> List<T> copyListAndRemoveIf(@NotNull final List<T> original,
|
||||
+ @NotNull final Predicate<T> removalPredicate) {
|
||||
+ final ImmutableList.Builder<T> builder = ImmutableList.builderWithExpectedSize(original.size());
|
||||
+ for (int i = 0; i < original.size(); i++) {
|
||||
+ final T value = original.get(i);
|
||||
+ if (removalPredicate.test(value)) continue;
|
||||
+
|
||||
+ builder.add(value);
|
||||
+ }
|
||||
+
|
||||
+ return builder.build();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/StackWalkerUtil.java b/src/main/java/io/papermc/paper/util/StackWalkerUtil.java
|
||||
new file mode 100644
|
||||
|
Reference in New Issue
Block a user