Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 565a5727 #533: Add consumed item, hand and consumeItem boolean to EntityShootBowEvent CraftBukkit Changes: 927200a9 #718: Add consumed item, hand and consumeItem boolean to EntityShootBowEvent
This commit is contained in:
parent
c970f88057
commit
1ab021ddca
|
@ -6,45 +6,39 @@ Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API
|
|||
Adds ability to get what arrow was shot, and control if it should be consumed.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
|
||||
index 18c5e31abcdc24320bb6c01e85ba85c848956bd4..37dbc12eb47060ebf0f6a18960d036bd27ce3740 100644
|
||||
index d4d7ad9c3c953680342c121f39ddaef476549047..719d0d878320c1903b44076053989ba99fa0e92a 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Projectile; // Paper
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -17,9 +18,30 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
|
||||
private Entity projectile;
|
||||
@@ -22,7 +22,32 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
|
||||
private final float force;
|
||||
private boolean consumeItem;
|
||||
private boolean cancelled;
|
||||
+ // Paper start
|
||||
+ private boolean consumeArrow = true;
|
||||
+ private final ItemStack arrowItem;
|
||||
+ @Deprecated
|
||||
+ public void setConsumeArrow(boolean consumeArrow) {
|
||||
+ this.consumeArrow = consumeArrow;
|
||||
+ }
|
||||
+ public boolean getConsumeArrow() {
|
||||
+ return consumeArrow;
|
||||
+ }
|
||||
|
||||
+ @NotNull
|
||||
+ public ItemStack getArrowItem() {
|
||||
+ return arrowItem;
|
||||
+ this.setConsumeItem(consumeArrow);
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) {
|
||||
+ this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force);
|
||||
+ public boolean getConsumeArrow() {
|
||||
+ return this.shouldConsumeItem();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull @Deprecated
|
||||
+ public ItemStack getArrowItem() {
|
||||
+ return this.getConsumable();
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) {
|
||||
+ this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force);
|
||||
+ }
|
||||
|
||||
+ @Deprecated
|
||||
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull ItemStack arrowItem, @NotNull final Entity projectile, final float force) {
|
||||
+ this(shooter, bow, arrowItem, projectile, EquipmentSlot.HAND, force, true);
|
||||
+ }
|
||||
+ // Paper end
|
||||
public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @Nullable final ItemStack consumable, @NotNull final Entity projectile, @NotNull final EquipmentSlot hand, final float force, final boolean consumeItem) {
|
||||
super(shooter);
|
||||
+ this.arrowItem = arrowItem;
|
||||
+ // Paper end
|
||||
this.bow = bow;
|
||||
this.projectile = projectile;
|
||||
this.force = force;
|
||||
|
|
|
@ -38,10 +38,10 @@ index 0182836a801da077ca0e6fcc75e7095454fb2349..17ae6530bda22144866e94e8449220d1
|
|||
entitywitch.prepare(worldserver, worldserver.getDamageScaler(entitywitch.getChunkCoordinates()), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitywitch.setNoAI(this.isNoAI());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index fb30199e4dc93057941a05e7ae426ec17ced196e..46e808d55cc33abebae387d6ecceef927eab0094 100644
|
||||
index 3f1edffa421524ef7646e70d8311e9161ed776a7..9ae73eab4a484731bf4b36fdf16d01ae7c364947 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1081,6 +1081,14 @@ public class CraftEventFactory {
|
||||
@@ -1083,6 +1083,14 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ index 23d5b7cb1a5cbe3409a0741af08b2fac8d1a58c1..604bdc5ab98071db88ac3e93ebf11869
|
|||
|
||||
this.die();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 46e808d55cc33abebae387d6ecceef927eab0094..e2b7886e63ab60110af9d01f2b8b86b7a9f79bc6 100644
|
||||
index 9ae73eab4a484731bf4b36fdf16d01ae7c364947..331b3e8df03eb737964def18ab4267f6a71315e2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -123,6 +123,7 @@ import org.bukkit.entity.ThrownPotion;
|
||||
|
@ -29,7 +29,7 @@ index 46e808d55cc33abebae387d6ecceef927eab0094..e2b7886e63ab60110af9d01f2b8b86b7
|
|||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Result;
|
||||
@@ -1040,6 +1041,17 @@ public class CraftEventFactory {
|
||||
@@ -1042,6 +1043,17 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,10 +71,10 @@ index 7391fd31148dbde60e34955841a296f454ac768e..53a8ea7d1eff84abe6c49464d556aa27
|
|||
|
||||
this.checkBlockCollisions();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index e2b7886e63ab60110af9d01f2b8b86b7a9f79bc6..848fc157dc8f22c793a523975066523424a92273 100644
|
||||
index 331b3e8df03eb737964def18ab4267f6a71315e2..de3565ec373066af1715e8e11117d22ae57e3c93 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1185,6 +1185,16 @@ public class CraftEventFactory {
|
||||
@@ -1187,6 +1187,16 @@ public class CraftEventFactory {
|
||||
return CraftItemStack.asNMSCopy(bitem);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ index e30f48caf2ce4f48f371b2594b765c27bc9e9778..2d8b354d707e8b5b0e7cd644fb93bc8f
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index dc8186b38930bf32f140a2da822cf359b6004a12..a96d6259f60dc5bfe477de54e837de5af066cca0 100644
|
||||
index de3565ec373066af1715e8e11117d22ae57e3c93..de207045cb007ca0b464d9f57f7f95ddeeb9bf6b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -582,16 +582,32 @@ public class CraftEventFactory {
|
||||
@@ -584,16 +584,32 @@ public class CraftEventFactory {
|
||||
EntityExperienceOrb xp = (EntityExperienceOrb) entity;
|
||||
double radius = world.spigotConfig.expMerge;
|
||||
if (radius > 0) {
|
||||
|
|
|
@ -8,10 +8,10 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
|
|||
metadata such as spawn reason, or conditionally move data from source to target.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index a96d6259f60dc5bfe477de54e837de5af066cca0..6b67e509e8a714cdee69c20f4456c9a08574c848 100644
|
||||
index de207045cb007ca0b464d9f57f7f95ddeeb9bf6b..8964687af2c86d4226c9c13c2d0a23bdaa7c4dae 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -592,7 +592,7 @@ public class CraftEventFactory {
|
||||
@@ -594,7 +594,7 @@ public class CraftEventFactory {
|
||||
if (e instanceof EntityExperienceOrb) {
|
||||
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
|
||||
// Paper start
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 15 Jun 2013 19:51:17 -0400
|
||||
Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API
|
||||
|
||||
Adds ability to get what arrow was shot, and control if it should be consumed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
index 3f4805af98aa5d27049ac12edd17455d78bf1827..1f7b50b559504d2e0b141525ef8c84c1ebd2225b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
@@ -155,7 +155,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow, 0.8F);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), this.getItemInOffHand(), entityarrow, 0.8F); // Paper
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java
|
||||
index 987b59dfcd3a69886e2722477300d313340690bb..b3cb832be6db70922c5495476e89124d75c9ed6d 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemBow.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemBow.java
|
||||
@@ -26,6 +26,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
|
||||
if ((double) f >= 0.1D) {
|
||||
boolean flag1 = flag && itemstack1.getItem() == Items.ARROW;
|
||||
|
||||
+ boolean consumeArrow = true; // Paper
|
||||
if (!world.isClientSide) {
|
||||
ItemArrow itemarrow = (ItemArrow) ((ItemArrow) (itemstack1.getItem() instanceof ItemArrow ? itemstack1.getItem() : Items.ARROW));
|
||||
EntityArrow entityarrow = itemarrow.a(world, itemstack1, (EntityLiving) entityhuman);
|
||||
@@ -51,7 +52,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
|
||||
entityarrow.setOnFire(100);
|
||||
}
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, itemstack1, entityarrow, f); // Paper
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
@@ -61,7 +62,8 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
|
||||
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.broadcastItemBreak(entityhuman.getRaisedHand());
|
||||
});
|
||||
- if (flag1 || entityhuman.abilities.canInstantlyBuild && (itemstack1.getItem() == Items.SPECTRAL_ARROW || itemstack1.getItem() == Items.TIPPED_ARROW)) {
|
||||
+ consumeArrow = event.getConsumeArrow(); // Paper
|
||||
+ if (!consumeArrow || flag1 || (entityhuman.abilities.canInstantlyBuild && ((itemstack1.getItem() == Items.SPECTRAL_ARROW) || (itemstack1.getItem() == Items.TIPPED_ARROW)))) { // Paper - add
|
||||
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
@@ -78,7 +80,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.RANDOM.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|
||||
- if (!flag1 && !entityhuman.abilities.canInstantlyBuild) {
|
||||
+ if (!flag1 && !entityhuman.abilities.canInstantlyBuild && consumeArrow) { // Paper
|
||||
itemstack1.subtract(1);
|
||||
if (itemstack1.isEmpty()) {
|
||||
entityhuman.inventory.f(itemstack1);
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
||||
index 1592e94c78611a4b968bfb24daf68570e778fadd..31c80bb0a2e403c34fb9cd4b3ee4e903d90dc356 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemCrossbow.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
||||
@@ -205,7 +205,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
|
||||
((IProjectile) object).shoot((double) vector3fa.a(), (double) vector3fa.b(), (double) vector3fa.c(), f1, f2);
|
||||
}
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, (Entity) object, f);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, (IProjectile) object, f); // Paper // TODO: consume??
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 6b67e509e8a714cdee69c20f4456c9a08574c848..0be27ad341ef59184d6c9f171e5e9f5a23d81f15 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -510,16 +510,16 @@ public class CraftEventFactory {
|
||||
/**
|
||||
* EntityShootBowEvent
|
||||
*/
|
||||
- public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, Entity entityArrow, float force) {
|
||||
+ public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, ItemStack arrowItem, IProjectile entityArrow, float force) { // paper
|
||||
LivingEntity shooter = (LivingEntity) who.getBukkitEntity();
|
||||
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
|
||||
- org.bukkit.entity.Entity arrow = entityArrow.getBukkitEntity();
|
||||
+ org.bukkit.entity.Entity arrow = ((Entity) entityArrow).getBukkitEntity(); // Paper
|
||||
|
||||
if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) {
|
||||
itemInHand = null;
|
||||
}
|
||||
|
||||
- EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force);
|
||||
+ EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, CraftItemStack.asCraftMirror(arrowItem), arrow, force); // Paper
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
return event;
|
|
@ -0,0 +1,44 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 15 Jun 2013 19:51:17 -0400
|
||||
Subject: [PATCH] Improve EntityShootBowEvent
|
||||
|
||||
Adds missing call to Illagers and also adds Arrow ItemStack to skeltons
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
index 2e03ddee685437061f123ede7c194b03d18076ee..73ac27913102f810a30bc704479b382f08a91132 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
@@ -134,8 +134,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
||||
+ // Paper start
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, entityliving.getRaisedHand(), 0.8F, true);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
+ this.world.addEntity(entityarrow);
|
||||
+ }
|
||||
this.playSound(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- this.world.addEntity(entityarrow);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
class a extends EntityIllagerWizard.c {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
index ac013d55c5df502d8a8cdf18237a0ca956a444c4..513bb3087ea8e81d36dcc8f78e22b6c63b26f582 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
@@ -155,7 +155,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), null, entityarrow, EnumHand.MAIN_HAND, 0.8F, true);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, EnumHand.MAIN_HAND, 0.8F, true); // Paper
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
|
@ -1,30 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 18 Jun 2018 22:19:36 -0400
|
||||
Subject: [PATCH] Fire EntityShootBowEvent for Illusioner
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
index 2e03ddee685437061f123ede7c194b03d18076ee..1c82316208f83d539cb61b20abbeb46db66a8c0b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
@@ -134,8 +134,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
||||
+ // Paper start
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), this.getItemInOffHand(), entityarrow,0.8F);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
+ this.world.addEntity(entityarrow);
|
||||
+ }
|
||||
this.playSound(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- this.world.addEntity(entityarrow);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
class a extends EntityIllagerWizard.c {
|
|
@ -193,10 +193,10 @@ index 23889ce169baf956cfb39f1ec21a8369f80c5555..25175230583bbd6fcfc864dcbae4111d
|
|||
|
||||
// Check if the fromWorld and toWorld are the same.
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 81fc5bcb24e94500bea1a78a369f6fd58865700e..68d9cbfcecffd3eeff38c1fc8a0bd19a251cdec9 100644
|
||||
index 8964687af2c86d4226c9c13c2d0a23bdaa7c4dae..db916dc8fb4375392080e7a9d54b996991be865f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1170,7 +1170,7 @@ public class CraftEventFactory {
|
||||
@@ -1172,7 +1172,7 @@ public class CraftEventFactory {
|
||||
|
||||
public static Container callInventoryOpenEvent(EntityPlayer player, Container container, boolean cancelled) {
|
||||
if (player.activeContainer != player.defaultContainer) { // fire INVENTORY_CLOSE if one already open
|
||||
|
@ -205,7 +205,7 @@ index 81fc5bcb24e94500bea1a78a369f6fd58865700e..68d9cbfcecffd3eeff38c1fc8a0bd19a
|
|||
}
|
||||
|
||||
CraftServer server = player.world.getServer();
|
||||
@@ -1335,12 +1335,22 @@ public class CraftEventFactory {
|
||||
@@ -1337,12 +1337,22 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Avoid item merge if stack size above max stack size
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index 8eab278382a937da80b97a7dea212ca960d42289..d8f8d04d6cc25d468bee04e2cbcc02c6f8202a1d 100644
|
||||
index 6d9a03a1ccc78ae9eeb654dd7fab9f23fcce74b8..78a2e28c9fe93cdbb2a7326a5d6fcb596724ad30 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -182,6 +182,10 @@ public class EntityItem extends Entity {
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
|
|||
Add -Ddebug.entities=true to your JVM flags to gain more information
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index d62d25af15dee1457df85dbc4db6f7f0a632ecba..b1d7c30690e09f60075b9d2cff47d6a53115118b 100644
|
||||
index f5c285909af563b91bb81638a3bcdf9f25584913..38a0a9313e46ce1f53fa48e99ad501b65deb1342 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -78,6 +78,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -40,7 +40,7 @@ index 8862bbd73b627e37709d46e6aeeee70c89cbd821..4bbcd00950405a4bf3ce391b557049a3
|
|||
|
||||
protected void g() {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 275442e07743e4e4e3f1468f58c50bb38ab7537a..b6af67e7625dd6e24fad5812d4b563b6ce91bede 100644
|
||||
index aefdcbeb1a452871a5a7376b4c259b3284f10d75..ae389806f62960816e6a8d0ab1bd8351c858546e 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -68,6 +68,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
|
@ -21,7 +21,7 @@ This is based upon conclusions drawn from inspecting the assenmbly generated byt
|
|||
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
index e126f9d1d03de085f2d09d53fe8bcc1972aedeff..4d574f83aff9fc295fb03c83cdb640a29fb40942 100644
|
||||
index 63a9ce32fb8b98695e104f7d820cd9b1a8f230b1..6b655b744d31d9660c7521ab596b27bcd92f4d58 100644
|
||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -39,7 +39,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
|
@ -19,7 +19,7 @@ index 6352051ab937d4d365e823a7112e76dc3ec34225..92ddf96f7db08a2b390ef3f49b0643f9
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index b6af67e7625dd6e24fad5812d4b563b6ce91bede..6202788306bea557c4699698a61c9336eb63a55d 100644
|
||||
index ae389806f62960816e6a8d0ab1bd8351c858546e..7cacffaab40d47f6fdd53bb526e9146a33f2ebc4 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -802,6 +802,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
|
@ -147,10 +147,10 @@ index 7cacffaab40d47f6fdd53bb526e9146a33f2ebc4..b7380f2ef554dc5f562340b7c59fd23c
|
|||
public boolean s_() {
|
||||
return this.isClientSide;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index fe88f7e62e547b9aa4ff273341aaee9209aed82b..fe8f149ad376b737c798d296ec77beef2362f7e3 100644
|
||||
index db916dc8fb4375392080e7a9d54b996991be865f..ee0212645425d70f4f5279f08d12bd75688eb6b1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1206,6 +1206,14 @@ public class CraftEventFactory {
|
||||
@@ -1208,6 +1208,14 @@ public class CraftEventFactory {
|
||||
Projectile projectile = (Projectile) entity.getBukkitEntity();
|
||||
org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
|
||||
com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);
|
|
@ -58,7 +58,7 @@ index bc249e399befa84cdf07cc58cd0072bb9cb5cced..3b3cae92513a85ba842d403c68f5a1fb
|
|||
return;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 90f5d8c9d04463d65bf8ab936b07d829b2b9f55d..5e96d7a8adc043ff7e1451d4ecdacb2cfc9d08c6 100644
|
||||
index 003f2a3bca8db71d25101b555ada81544e319425..174329b9adbfa9de61f76ee92c85f6c77d65d3dc 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -73,6 +73,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
@ -51,7 +51,7 @@ index 3b3cae92513a85ba842d403c68f5a1fb8fde785d..5ee581d1634f44a98756c5d11def9c3d
|
|||
if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check
|
||||
list.add(t0);
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 5e96d7a8adc043ff7e1451d4ecdacb2cfc9d08c6..1a05de09824360c451a4b0354d1a8f486432ec7b 100644
|
||||
index 174329b9adbfa9de61f76ee92c85f6c77d65d3dc..2e1214c9ebf7915aa25aa4d405ec75f73d8e0594 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -192,6 +192,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
@ -73,7 +73,7 @@ index 48958308a89cbe39e1b4dddcdd8d1d0b5ece6339..120bf8436fd82294c339add2e7bff1cd
|
|||
int i = blockposition.getX();
|
||||
int j = blockposition.getY();
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 5e6aa9cd63a103b9460c221a3e6c1e431d209d36..b46c6f7f5e8bf586235b3144dee4e4ce64e89947 100644
|
||||
index b7380f2ef554dc5f562340b7c59fd23cd1f271c1..8bb5f35dd211ef0267f55678bb568a7d3b9980ec 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -218,6 +218,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
@ -126,7 +126,7 @@ index 13370a4a0d210bd3b14a26f60b1cd9a9a3a6c941..0b7047863bb3a3f3d61491bb1924b94a
|
|||
public float v() {
|
||||
return this.worldData.d();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 108289ba7ac5fdf08229bb23059847a178910695..c40004cc3a9583c9ece058ff8eb059731385c415 100644
|
||||
index ee0212645425d70f4f5279f08d12bd75688eb6b1..b9dae2166f235b279a4d2a211177a1e00c5c4f31 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -233,7 +233,7 @@ public class CraftEventFactory {
|
|
@ -122,7 +122,7 @@ index 5b01e4edb3c0f8bc785b70128cbe31b14356e4fb..9213bfb78e92b838189161045e394558
|
|||
|
||||
this.d.values().stream().map((jsonlistentry) -> {
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 8c77970d848b9628ddc4c66679d7ba8044641173..3501588adf539a05a5056c9a4f45d49d9d656a37 100644
|
||||
index df8a92b082139c84afc32cf02541faa82c914d4f..bc31e882e77f5b8657107db1e3a830df4cf561e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -543,7 +543,7 @@ public abstract class PlayerList {
|
|
@ -373,10 +373,10 @@ index b90b35c08cdc9bb44aaf9f4824289fd0824c937f..28a04cb8a90ad82b86f658ad17675ab5
|
|||
|
||||
public void injectScaledMaxHealth(Collection<AttributeModifiable> collection, boolean force) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index c40004cc3a9583c9ece058ff8eb059731385c415..be7e98dc6f8faf4ebfd24df035ade809a3e4c918 100644
|
||||
index b9dae2166f235b279a4d2a211177a1e00c5c4f31..90ab1c85f9b9055172e01fe4ba899c9eda6f5cfa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -788,9 +788,16 @@ public class CraftEventFactory {
|
||||
@@ -790,9 +790,16 @@ public class CraftEventFactory {
|
||||
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
|
||||
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
|
||||
EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
|
||||
|
@ -393,7 +393,7 @@ index c40004cc3a9583c9ece058ff8eb059731385c415..be7e98dc6f8faf4ebfd24df035ade809
|
|||
victim.expToDrop = event.getDroppedExp();
|
||||
|
||||
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
||||
@@ -806,8 +813,15 @@ public class CraftEventFactory {
|
||||
@@ -808,8 +815,15 @@ public class CraftEventFactory {
|
||||
CraftPlayer entity = victim.getBukkitEntity();
|
||||
PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage);
|
||||
event.setKeepInventory(keepInventory);
|
||||
|
@ -409,7 +409,7 @@ index c40004cc3a9583c9ece058ff8eb059731385c415..be7e98dc6f8faf4ebfd24df035ade809
|
|||
|
||||
victim.keepLevel = event.getKeepLevel();
|
||||
victim.newLevel = event.getNewLevel();
|
||||
@@ -824,6 +838,31 @@ public class CraftEventFactory {
|
||||
@@ -826,6 +840,31 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..fdd8708f974700c7cde6e436c2f189d9
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
index f2ab2f7f81b95546294debaf1f0395b0c094ab44..44054552a1e0efaba0f69573bfb67f4a126507c6 100644
|
||||
index a3555dd251af5dd4b320428aadaffe7063ecd356..afbe6defdffd967a841ebe51d260c418dcd23590 100644
|
||||
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
@@ -25,6 +25,7 @@ import org.bukkit.craftbukkit.util.Waitable;
|
|
@ -34,7 +34,7 @@ how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent
|
|||
is undefined.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
index 44054552a1e0efaba0f69573bfb67f4a126507c6..c053c40a940bbfebbae48464d5f9e263f54af523 100644
|
||||
index afbe6defdffd967a841ebe51d260c418dcd23590..0cb8f5a4a5cc5e302815af4c1ed325dfbc75235b 100644
|
||||
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
@@ -35,9 +35,9 @@ public class LoginListener implements PacketLoginInListener {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue