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 @@
|
2018-09-15 11:07:03 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
if (k <= 0 || entityhuman.isInWaterOrRain()) {
|
2018-09-15 11:07:03 +02:00
|
|
|
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
|
|
|
});
|
|
|
|
+ */
|
2018-09-15 11:07:03 +02:00
|
|
|
if (k == 0) {
|
|
|
|
EntityThrownTrident entitythrowntrident = new EntityThrownTrident(world, entityhuman, itemstack);
|
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -54,16 +57,40 @@
|
2018-09-15 07:31:39 +02:00
|
|
|
entitythrowntrident.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
|
|
|
}
|
|
|
|
|
|
|
|
- world.addEntity(entitythrowntrident);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (!world.addEntity(entitythrowntrident)) {
|
|
|
|
+ if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
2018-09-15 11:07:03 +02:00
|
|
|
+
|
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
|
2018-09-15 07:31:39 +02:00
|
|
|
+ // 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);
|
2018-09-15 07:31:39 +02:00
|
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
entityhuman.inventory.f(itemstack);
|
2019-12-17 02:22:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
+ // 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());
|
2019-12-17 02:22:53 +01:00
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ // 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);
|