2018-08-02 01:38:52 +02:00
|
|
|
--- a/net/minecraft/server/ItemTrident.java
|
|
|
|
+++ b/net/minecraft/server/ItemTrident.java
|
|
|
|
@@ -6,9 +6,13 @@
|
|
|
|
|
|
|
|
public ItemTrident(Item.Info item_info) {
|
|
|
|
super(item_info);
|
|
|
|
+ // CraftBukkit start - obfuscator went a little crazy
|
|
|
|
+ /*
|
|
|
|
this.a(new MinecraftKey("throwing"), (itemstack, world, entityliving) -> {
|
2019-12-10 23:00:00 +01:00
|
|
|
return entityliving != null && entityliving.isHandRaised() && entityliving.dD() == itemstack ? 1.0F : 0.0F;
|
2018-08-02 01:38:52 +02:00
|
|
|
});
|
|
|
|
+ */
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
|
|
|
@@ -37,9 +41,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);
|
|
|
|
|
2019-12-17 02:22:53 +01:00
|
|
|
@@ -48,16 +55,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);
|