diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/FishingRodItem.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/item/FishingRodItem.java.patch | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/FishingRodItem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/FishingRodItem.java.patch new file mode 100644 index 0000000000..f8e99a2b8f --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/FishingRodItem.java.patch @@ -0,0 +1,80 @@ +--- a/net/minecraft/world/item/FishingRodItem.java ++++ b/net/minecraft/world/item/FishingRodItem.java +@@ -3,7 +3,7 @@ + import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.stats.Stats; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResultHolder; + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.entity.projectile.FishingHook; +@@ -11,35 +11,50 @@ + import net.minecraft.world.level.Level; + import net.minecraft.world.level.gameevent.GameEvent; + +-public class FishingRodItem extends Item implements Vanishable { ++// CraftBukkit start ++import org.bukkit.event.player.PlayerFishEvent; ++import org.bukkit.craftbukkit.CraftEquipmentSlot; ++// CraftBukkit end + +- public FishingRodItem(Item.Properties item_properties) { +- super(item_properties); ++public class FishingRodItem extends Item implements ItemVanishable { ++ ++ public FishingRodItem(Item.Properties properties) { ++ super(properties); + } + + @Override +- @Override +- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand interactionhand) { +- ItemStack itemstack = player.getItemInHand(interactionhand); ++ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) { ++ ItemStack itemstack = player.getItemInHand(hand); + int i; + + if (player.fishing != null) { + if (!level.isClientSide) { + i = player.fishing.retrieve(itemstack); +- itemstack.hurtAndBreak(i, player, (player1) -> { +- player1.broadcastBreakEvent(interactionhand); ++ itemstack.hurtAndBreak(i, player, (entityhuman1) -> { ++ entityhuman1.broadcastBreakEvent(hand); + }); + } + + level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.NEUTRAL, 1.0F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); + player.gameEvent(GameEvent.ITEM_INTERACT_FINISH); + } else { +- level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.FISHING_BOBBER_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); ++ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); + if (!level.isClientSide) { + i = EnchantmentHelper.getFishingSpeedBonus(itemstack); + int j = EnchantmentHelper.getFishingLuckBonus(itemstack); + +- level.addFreshEntity(new FishingHook(player, level, j, i)); ++ // CraftBukkit start ++ FishingHook entityfishinghook = new FishingHook(player, level, j, i); ++ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) player.getBukkitEntity(), null, (org.bukkit.entity.FishHook) entityfishinghook.getBukkitEntity(), CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.FISHING); ++ level.getCraftServer().getPluginManager().callEvent(playerFishEvent); ++ ++ if (playerFishEvent.isCancelled()) { ++ player.fishing = null; ++ return InteractionResultHolder.pass(itemstack); ++ } ++ level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.FISHING_BOBBER_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); ++ level.addFreshEntity(entityfishinghook); ++ // CraftBukkit end + } + + player.awardStat(Stats.ITEM_USED.get(this)); +@@ -50,7 +65,6 @@ + } + + @Override +- @Override + public int getEnchantmentValue() { + return 1; + } |