geforkt von Mirrors/Paper
2873869bb1
Signs no longer have a specific isEdiable state, the entire API in this regard needs updating/deprecation. The boolean field is completely gone, replaced by a uuid (which will need a new setEditingPlayer(UUID) method on the Sign interface), and the current upstream implementation of setEdiable simply flips the is_waxed state. This patch is hence not needed as it neither allows editing (which will be redone in a later patch) nor is required to copy the is_waxed boolean flag as it lives in the signs compound tag and is covered by applyTo.
70 Zeilen
3.6 KiB
Diff
70 Zeilen
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MelnCat <melncatuwu@gmail.com>
|
|
Date: Mon, 19 Sep 2022 14:16:10 -0700
|
|
Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index 8b6cae9a005a6db608be85805382704ff5dc6669..d15a252285e10ce062319b0f1051f59ba46701a0 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -500,8 +500,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
}
|
|
|
|
@Override
|
|
- @SuppressWarnings("unchecked")
|
|
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
|
|
+ // Paper start - launchProjectile consumer
|
|
+ return this.launchProjectile(projectile, velocity, null);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, org.bukkit.util.Consumer<T> function) {
|
|
+ // Paper end - launchProjectile consumer
|
|
Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation");
|
|
|
|
net.minecraft.world.level.Level world = ((CraftWorld) getWorld()).getHandle();
|
|
@@ -584,6 +591,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
if (velocity != null) {
|
|
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
|
}
|
|
+ // Paper start - launchProjectile consumer
|
|
+ if (function != null) {
|
|
+ function.accept((T) launch.getBukkitEntity());
|
|
+ }
|
|
+ // Paper end - launchProjectile consumer
|
|
|
|
world.addFreshEntity(launch);
|
|
return (T) launch.getBukkitEntity();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java b/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java
|
|
index 388647c2ef814270942f4e6c6eb57a3abaf84212..2afb7af0a90959edd3b0ead2fe4d9018b5560aa4 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java
|
|
@@ -57,6 +57,13 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
|
|
|
@Override
|
|
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
|
|
+ // Paper start - launchProjectile consumer
|
|
+ return this.launchProjectile(projectile, velocity, null);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, org.bukkit.util.Consumer<T> function) {
|
|
+ // Paper end - launchProjectile consumer
|
|
Validate.isTrue(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
|
// Copied from BlockDispenser.dispense()
|
|
BlockSourceImpl isourceblock = new BlockSourceImpl((ServerLevel) this.dispenserBlock.getLevel(), this.dispenserBlock.getBlockPos());
|
|
@@ -147,6 +154,11 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
|
if (velocity != null) {
|
|
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
|
}
|
|
+ // Paper start
|
|
+ if (function != null) {
|
|
+ function.accept((T) launch.getBukkitEntity());
|
|
+ }
|
|
+ // Paper end
|
|
|
|
world.addFreshEntity(launch);
|
|
return (T) launch.getBukkitEntity();
|