More ThrownPotion API
Dieser Commit ist enthalten in:
Ursprung
5bf259115c
Commit
4516aedb43
@ -3,6 +3,7 @@ From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Wed, 26 May 2021 19:34:43 -0400
|
||||
Subject: [PATCH] More Projectile API
|
||||
|
||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Firework.java b/src/main/java/org/bukkit/entity/Firework.java
|
||||
index d616d5941b3c7b85e350e845901da798601b9a3c..b7a6e3b1ac327c4e03f9d73952c1ce4d54967cf4 100644
|
||||
@ -96,10 +97,19 @@ index d1b37530319f6d37ee37f62080289c1e45848bc8..e94c7e279356c510f60508b26277d489
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/ThrownPotion.java b/src/main/java/org/bukkit/entity/ThrownPotion.java
|
||||
index 10a3c297bd87ad3ab4555054858f47a479e76e1a..1afda5d6d948b7e8589e69d3cd2c045763b5e784 100644
|
||||
index 10a3c297bd87ad3ab4555054858f47a479e76e1a..977e150569bed69d5d28ae685c9c4a7903fa42a0 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ThrownPotion.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ThrownPotion.java
|
||||
@@ -32,12 +32,29 @@ public interface ThrownPotion extends Projectile {
|
||||
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a thrown potion bottle
|
||||
*/
|
||||
-public interface ThrownPotion extends Projectile {
|
||||
+public interface ThrownPotion extends ThrowableProjectile { // Paper - extend ThrowableProjectile
|
||||
|
||||
/**
|
||||
* Returns the effects that are applied by this potion.
|
||||
@@ -32,12 +32,34 @@ public interface ThrownPotion extends Projectile {
|
||||
|
||||
/**
|
||||
* Set the ItemStack for this thrown potion.
|
||||
@ -131,5 +141,10 @@ index 10a3c297bd87ad3ab4555054858f47a479e76e1a..1afda5d6d948b7e8589e69d3cd2c0457
|
||||
+ * @param meta potion meta
|
||||
+ */
|
||||
+ void setPotionMeta(@NotNull org.bukkit.inventory.meta.PotionMeta meta);
|
||||
+
|
||||
+ /**
|
||||
+ * Splashes the potion at its current location.
|
||||
+ */
|
||||
+ void splash();
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -3,7 +3,33 @@ From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Tue, 22 Jun 2021 23:41:11 -0400
|
||||
Subject: [PATCH] More Projectile API
|
||||
|
||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
index fee09e6ff72cf1da389d5811dd005642cd50a5b4..4f276b2a86735a2c664738450ae0fbdd82031d4e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
@@ -98,6 +98,11 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
@Override
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
+ // Paper start - More projectile API
|
||||
+ this.splash(hitResult);
|
||||
+ }
|
||||
+ public void splash(@org.jetbrains.annotations.Nullable HitResult hitResult) {
|
||||
+ // Paper end - More projectile API
|
||||
if (!this.level.isClientSide) {
|
||||
ItemStack itemstack = this.getItem();
|
||||
Potion potionregistry = PotionUtils.getPotion(itemstack);
|
||||
@@ -110,7 +115,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
if (this.isLingering()) {
|
||||
this.makeAreaOfEffectCloud(itemstack, potionregistry);
|
||||
} else {
|
||||
- this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null);
|
||||
+ this.applySplash(list, hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null); // Paper - nullable hitResult
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
index be86114eac3975b82ca74d4d6ed3f0402a642e8a..93fd9e87de3078f50431b5d80540d4335d7c79e5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
@ -132,10 +158,10 @@ index 6bfa984781a483d048ef4318761203c701d8a632..5e0c2c5094e1578162d1a50d50701fbd
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
||||
index b08739dd1ffd041f0885af6c1f57dca9027763b6..c1594f62c06a49ba2d0c2c6e6befcda7d1fe6e1b 100644
|
||||
index b08739dd1ffd041f0885af6c1f57dca9027763b6..73293157d694adb5a9a41c2cf350c6400f2e8206 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
||||
@@ -39,11 +39,26 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
|
||||
@@ -39,11 +39,31 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
|
||||
Validate.notNull(item, "ItemStack cannot be null.");
|
||||
|
||||
// The ItemStack must be a potion.
|
||||
@ -159,6 +185,11 @@ index b08739dd1ffd041f0885af6c1f57dca9027763b6..c1594f62c06a49ba2d0c2c6e6befcda7
|
||||
+ CraftItemStack.applyMetaToItem(item, meta);
|
||||
+ this.getHandle().setItem(item); // Reset item
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void splash() {
|
||||
+ this.getHandle().splash(null);
|
||||
+ }
|
||||
+ // Paper end
|
||||
@Override
|
||||
public net.minecraft.world.entity.projectile.ThrownPotion getHandle() {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren