Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemFishingRod.java
+++ b/net/minecraft/world/item/ItemFishingRod.java
@@ -13,6 +13,11 @@
@@ -14,6 +14,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.gameevent.GameEvent;
@@ -12,7 +12,7 @@
public class ItemFishingRod extends Item {
public ItemFishingRod(Item.Info item_info) {
@@ -33,13 +38,24 @@
@@ -34,13 +39,24 @@
world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
entityhuman.gameEvent(GameEvent.ITEM_INTERACT_FINISH);
} else {
@@ -23,18 +23,18 @@
int j = (int) (EnchantmentManager.getFishingTimeReduction(worldserver, itemstack, entityhuman) * 20.0F);
int k = EnchantmentManager.getFishingLuckBonus(worldserver, itemstack, entityhuman);
- world.addFreshEntity(new EntityFishingHook(entityhuman, world, k, j));
- IProjectile.spawnProjectile(new EntityFishingHook(entityhuman, world, k, j, itemstack), worldserver, itemstack);
+ // CraftBukkit start
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, k, j);
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, k, j, itemstack);
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.FishHook) entityfishinghook.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand), PlayerFishEvent.State.FISHING);
+ world.getCraftServer().getPluginManager().callEvent(playerFishEvent);
+
+ if (playerFishEvent.isCancelled()) {
+ entityhuman.fishing = null;
+ return InteractionResultWrapper.pass(itemstack);
+ return EnumInteractionResult.PASS;
+ }
+ 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));
+ world.addFreshEntity(entityfishinghook);
+ IProjectile.spawnProjectile(entityfishinghook, worldserver, itemstack);
+ // CraftBukkit end
}