mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 09:23:42 +01:00
38 lines
2.1 KiB
Diff
38 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: JRoy <joshroy126@gmail.com>
|
|
Date: Wed, 7 Oct 2020 12:04:01 -0400
|
|
Subject: [PATCH] Add EntityLoadCrossbowEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
|
index 14c0e7382292b3d39858d4d957df8016c301c712..9bf5d77db3bca4073867139844fbcdcc4d3f7c83 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemCrossbow.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
|
@@ -1,6 +1,7 @@
|
|
package net.minecraft.server;
|
|
|
|
import com.google.common.collect.Lists;
|
|
+import io.papermc.paper.event.entity.EntityLoadCrossbowEvent; // Paper - EntityLoadCrossbowEvent namespace conflicts
|
|
import java.util.List;
|
|
import java.util.Random;
|
|
import java.util.function.Predicate;
|
|
@@ -50,7 +51,10 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
|
|
int j = this.e_(itemstack) - i;
|
|
float f = a(j, itemstack);
|
|
|
|
- if (f >= 1.0F && !d(itemstack) && a(entityliving, itemstack)) {
|
|
+ // Paper start - EntityLoadCrossbowEvent
|
|
+ if (f >= 1.0F && !d(itemstack) /*&& a(entityliving, itemstack)*/) {
|
|
+ if (!new EntityLoadCrossbowEvent(entityliving.getBukkitLivingEntity(), itemstack.asBukkitMirror(), entityliving.getRaisedHand() == EnumHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND).callEvent() || !attemptProjectileLoad(entityliving, itemstack)) return;
|
|
+ // Paper end
|
|
a(itemstack, true);
|
|
SoundCategory soundcategory = entityliving instanceof EntityHuman ? SoundCategory.PLAYERS : SoundCategory.HOSTILE;
|
|
|
|
@@ -59,6 +63,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
|
|
|
|
}
|
|
|
|
+ private static boolean attemptProjectileLoad(EntityLiving ent, ItemStack bow) { return a(ent, bow); } // Paper - EntityLoadCrossbowEvent - OBFHELPER
|
|
private static boolean a(EntityLiving entityliving, ItemStack itemstack) {
|
|
int i = EnchantmentManager.getEnchantmentLevel(Enchantments.MULTISHOT, itemstack);
|
|
int j = i == 0 ? 1 : 3;
|