aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/item/FishingRodItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/item/FishingRodItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/item/FishingRodItem.java.patch98
1 files changed, 98 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/item/FishingRodItem.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/item/FishingRodItem.java.patch
new file mode 100644
index 0000000000..b426cb8fe7
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/item/FishingRodItem.java.patch
@@ -0,0 +1,98 @@
+--- 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,53 +11,57 @@
+ 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 class FishingRodItem extends Item implements ItemVanishable {
++
+ public FishingRodItem(Item.Properties properties) {
+ super(properties);
+ }
+
+ @Override
+- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
+- ItemStack itemInHand = player.getItemInHand(hand);
++ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) {
++ ItemStack itemstack = player.getItemInHand(hand);
++ int i;
++
+ if (player.fishing != null) {
+ if (!level.isClientSide) {
+- int i = player.fishing.retrieve(itemInHand);
+- itemInHand.hurtAndBreak(i, player, contextEntity -> contextEntity.broadcastBreakEvent(hand));
++ i = player.fishing.retrieve(itemstack);
++ itemstack.hurtAndBreak(i, player, (entityhuman1) -> {
++ entityhuman1.broadcastBreakEvent(hand);
++ });
+ }
+
+- level.playSound(
+- null,
+- player.getX(),
+- player.getY(),
+- player.getZ(),
+- SoundEvents.FISHING_BOBBER_RETRIEVE,
+- SoundSource.NEUTRAL,
+- 1.0F,
+- 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)
+- );
++ 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(
+- 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) {
+- int i = EnchantmentHelper.getFishingSpeedBonus(itemInHand);
+- int fishingLuckBonus = EnchantmentHelper.getFishingLuckBonus(itemInHand);
+- level.addFreshEntity(new FishingHook(player, level, fishingLuckBonus, i));
++ i = EnchantmentHelper.getFishingSpeedBonus(itemstack);
++ int j = EnchantmentHelper.getFishingLuckBonus(itemstack);
++
++ // 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));
+ player.gameEvent(GameEvent.ITEM_INTERACT_START);
+ }
+
+- return InteractionResultHolder.sidedSuccess(itemInHand, level.isClientSide());
++ return InteractionResultHolder.sidedSuccess(itemstack, level.isClientSide());
+ }
+
+ @Override