Update to Minecraft 1.21

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-06-14 01:05:00 +10:00
parent 7c6204e1a9
commit eed041d629
255 changed files with 3585 additions and 3261 deletions

View File

@@ -1,15 +1,10 @@
--- a/net/minecraft/world/item/ItemProjectileWeapon.java
+++ b/net/minecraft/world/item/ItemProjectileWeapon.java
@@ -59,11 +59,28 @@
float f6 = f4 + f5 * (float) ((i + 1) / 2) * f3;
f5 = -f5;
- itemstack.hurtAndBreak(this.getDurabilityUse(itemstack1), entityliving, EntityLiving.getSlotForHand(enumhand));
+ // itemstack.hurtAndBreak(this.getDurabilityUse(itemstack1), entityliving, EntityLiving.getSlotForHand(enumhand)); // CraftBukkit - moved down
IProjectile iprojectile = this.createProjectile(world, entityliving, itemstack, itemstack1, flag);
@@ -62,7 +62,22 @@
IProjectile iprojectile = this.createProjectile(worldserver, entityliving, itemstack, itemstack1, flag);
this.shootProjectile(entityliving, iprojectile, i, f, f1, f6, entityliving1);
- world.addFreshEntity(iprojectile);
- worldserver.addFreshEntity(iprojectile);
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, iprojectile, enumhand, f, true);
+ if (event.isCancelled()) {
@@ -17,10 +12,8 @@
+ return;
+ }
+
+ itemstack.hurtAndBreak(this.getDurabilityUse(itemstack1), entityliving, EntityLiving.getSlotForHand(enumhand));
+
+ if (event.getProjectile() == iprojectile.getBukkitEntity()) {
+ if (!world.addFreshEntity(iprojectile)) {
+ if (!worldserver.addFreshEntity(iprojectile)) {
+ if (entityliving instanceof net.minecraft.server.level.EntityPlayer) {
+ ((net.minecraft.server.level.EntityPlayer) entityliving).getBukkitEntity().updateInventory();
+ }
@@ -28,6 +21,6 @@
+ }
+ }
+ // CraftBukkit end
}
}
itemstack.hurtAndBreak(this.getDurabilityUse(itemstack1), entityliving, EntityLiving.getSlotForHand(enumhand));
if (itemstack.isEmpty()) {
break;