3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00
Paper/nms-patches/ItemTrident.patch

58 Zeilen
3.2 KiB
Diff

2018-08-02 01:38:52 +02:00
--- a/net/minecraft/server/ItemTrident.java
+++ b/net/minecraft/server/ItemTrident.java
2020-06-25 02:00:00 +02:00
@@ -43,9 +43,12 @@
2019-04-23 04:00:00 +02:00
if (k <= 0 || entityhuman.isInWaterOrRain()) {
if (!world.isClientSide) {
2019-04-23 04:00:00 +02:00
+ // CraftBukkit - moved down
+ /*
itemstack.damage(1, entityhuman, (entityhuman1) -> {
2020-01-21 22:00:00 +01:00
entityhuman1.broadcastItemBreak(entityliving.getRaisedHand());
2019-04-23 04:00:00 +02:00
});
+ */
if (k == 0) {
EntityThrownTrident entitythrowntrident = new EntityThrownTrident(world, entityhuman, itemstack);
2020-06-25 02:00:00 +02:00
@@ -54,16 +57,40 @@
entitythrowntrident.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
- world.addEntity(entitythrowntrident);
+ // CraftBukkit start
+ if (!world.addEntity(entitythrowntrident)) {
+ if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return;
+ }
+
2019-04-23 04:00:00 +02:00
+ itemstack.damage(1, entityhuman, (entityhuman1) -> {
2020-01-21 22:00:00 +01:00
+ entityhuman1.broadcastItemBreak(entityliving.getRaisedHand());
2019-04-23 04:00:00 +02:00
+ });
2018-12-06 00:00:00 +01:00
+ entitythrowntrident.trident = itemstack.cloneItemStack(); // SPIGOT-4511 update since damage call moved
+ // CraftBukkit end
+
2019-07-20 01:00:00 +02:00
world.playSound((EntityHuman) null, (Entity) entitythrowntrident, SoundEffects.ITEM_TRIDENT_THROW, SoundCategory.PLAYERS, 1.0F, 1.0F);
if (!entityhuman.abilities.canInstantlyBuild) {
entityhuman.inventory.f(itemstack);
}
}
+ // CraftBukkit start - SPIGOT-5458 also need in this branch :(
+ else {
+ itemstack.damage(1, entityhuman, (entityhuman1) -> {
2020-01-21 22:00:00 +01:00
+ entityhuman1.broadcastItemBreak(entityliving.getRaisedHand());
+ });
+ }
+ // CraftBukkkit end
}
2018-08-02 01:38:52 +02:00
2019-04-23 04:00:00 +02:00
entityhuman.b(StatisticList.ITEM_USED.b(this));
2018-08-02 01:38:52 +02:00
if (k > 0) {
+ // CraftBukkit start
+ org.bukkit.event.player.PlayerRiptideEvent event = new org.bukkit.event.player.PlayerRiptideEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+ event.getPlayer().getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
float f = entityhuman.yaw;
float f1 = entityhuman.pitch;
float f2 = -MathHelper.sin(f * 0.017453292F) * MathHelper.cos(f1 * 0.017453292F);