Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 19:40:07 +01:00
fe18b38aea
I misread the code and thought the code kept looping until the mob spawn cap was hit. Upon furthur review, this is not true, so this patch doesn't do anything sane.
59 Zeilen
1.9 KiB
Diff
59 Zeilen
1.9 KiB
Diff
From 7fa53b55160cf63907e2ff84cf3ed9e1783882af Mon Sep 17 00:00:00 2001
|
|
From: Jedediah Smith <jedediah@silencegreys.com>
|
|
Date: Fri, 4 Mar 2016 03:16:11 -0500
|
|
Subject: [PATCH] Arrow pickup rule API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
|
|
index 2a3482c..fbf289f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
|
|
@@ -72,6 +72,44 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
|
|
getHandle().shooter = ((CraftLivingEntity) shooter).getHandle();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public PickupRule getPickupRule() {
|
|
+ return convertPickupRule(this.getHandle().fromPlayer);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setPickupRule(PickupRule rule) {
|
|
+ this.getHandle().fromPlayer = convertPickupRule(rule);
|
|
+ }
|
|
+
|
|
+ public static PickupRule convertPickupRule(EntityArrow.PickupStatus nms) {
|
|
+ switch (nms) {
|
|
+ case DISALLOWED:
|
|
+ return PickupRule.DISALLOWED;
|
|
+ case ALLOWED:
|
|
+ return PickupRule.ALLOWED;
|
|
+ case CREATIVE_ONLY:
|
|
+ return PickupRule.CREATIVE_ONLY;
|
|
+ default:
|
|
+ throw new IllegalStateException();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static EntityArrow.PickupStatus convertPickupRule(PickupRule bukkit) {
|
|
+ switch (bukkit) {
|
|
+ case DISALLOWED:
|
|
+ return EntityArrow.PickupStatus.DISALLOWED;
|
|
+ case ALLOWED:
|
|
+ return EntityArrow.PickupStatus.ALLOWED;
|
|
+ case CREATIVE_ONLY:
|
|
+ return EntityArrow.PickupStatus.CREATIVE_ONLY;
|
|
+ default:
|
|
+ throw new IllegalStateException();
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
// Spigot start
|
|
private final Arrow.Spigot spigot = new Arrow.Spigot()
|
|
{
|
|
--
|
|
2.7.4 (Apple Git-66)
|
|
|