13
0
geforkt von Mirrors/Paper

More ThrownPotion API

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-08-14 16:53:36 +02:00
Ursprung 89ee9379b2
Commit 1e9ec27588
2 geänderte Dateien mit 46 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -99,6 +100,15 @@ diff --git a/src/main/java/org/bukkit/entity/ThrownPotion.java b/src/main/java/o
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/ThrownPotion.java
+++ b/src/main/java/org/bukkit/entity/ThrownPotion.java
@@ -0,0 +0,0 @@ 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.
@@ -0,0 +0,0 @@ public interface ThrownPotion extends Projectile {
/**
@ -131,5 +141,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @param meta potion meta
+ */
+ void setPotionMeta(@NotNull org.bukkit.inventory.meta.PotionMeta meta);
+
+ /**
+ * Splashes the potion at its current location.
+ */
+ void splash();
+ // Paper end
}

Datei anzeigen

@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@ -159,6 +185,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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() {