geforkt von Mirrors/Paper
72 Zeilen
3.6 KiB
Diff
72 Zeilen
3.6 KiB
Diff
--- 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) -> {
|
|
return entityliving != null && entityliving.isHandRaised() && entityliving.dD() == itemstack ? 1.0F : 0.0F;
|
|
});
|
|
+ */
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
@Override
|
|
@@ -37,9 +41,12 @@
|
|
|
|
if (k <= 0 || entityhuman.isInWaterOrRain()) {
|
|
if (!world.isClientSide) {
|
|
+ // CraftBukkit - moved down
|
|
+ /*
|
|
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
|
entityhuman1.d(entityliving.getRaisedHand());
|
|
});
|
|
+ */
|
|
if (k == 0) {
|
|
EntityThrownTrident entitythrowntrident = new EntityThrownTrident(world, entityhuman, itemstack);
|
|
|
|
@@ -48,16 +55,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;
|
|
+ }
|
|
+
|
|
+ itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
|
+ entityhuman1.d(entityliving.getRaisedHand());
|
|
+ });
|
|
+ entitythrowntrident.trident = itemstack.cloneItemStack(); // SPIGOT-4511 update since damage call moved
|
|
+ // CraftBukkit end
|
|
+
|
|
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) -> {
|
|
+ entityhuman1.d(entityliving.getRaisedHand());
|
|
+ });
|
|
+ }
|
|
+ // CraftBukkkit end
|
|
}
|
|
|
|
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
|
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);
|