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) -> {
|
|
|
|
return entityliving != null && entityliving.isHandRaised() && entityliving.cW() == itemstack ? 1.0F : 0.0F;
|
|
|
|
});
|
|
|
|
+ */
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
2018-09-15 11:07:03 +02:00
|
|
|
@@ -33,7 +37,7 @@
|
|
|
|
|
|
|
|
if (k <= 0 || entityhuman.ao()) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
- itemstack.damage(1, entityhuman);
|
|
|
|
+ // itemstack.damage(1, entityhuman); // CraftBukkit - moved down
|
|
|
|
if (k == 0) {
|
|
|
|
EntityThrownTrident entitythrowntrident = new EntityThrownTrident(world, entityhuman, itemstack);
|
|
|
|
|
|
|
|
@@ -42,7 +46,17 @@
|
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
|
|
|
+
|
|
|
|
+ itemstack.damage(1, entityhuman);
|
2018-09-15 07:31:39 +02:00
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
|
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
entityhuman.inventory.f(itemstack);
|
|
|
|
}
|
2018-09-15 11:07:03 +02:00
|
|
|
@@ -53,6 +67,10 @@
|
2018-08-02 01:38:52 +02:00
|
|
|
SoundEffect soundeffect = SoundEffects.ITEM_TRIDENT_THROW;
|
|
|
|
|
|
|
|
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);
|