[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke
2024-01-19 22:13:42 +01:00
parent 3c246dc632
commit 66431e1300
84 changed files with 265 additions and 271 deletions

View File

@@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
float f = CrossbowItem.getPowerForTime(j, stack);
- if (f >= 1.0F && !CrossbowItem.isCharged(stack) && CrossbowItem.tryLoadProjectiles(user, stack)) {
+ // Paper start - EntityLoadCrossbowEvent
+ // Paper start - Add EntityLoadCrossbowEvent
+ if (f >= 1.0F && !CrossbowItem.isCharged(stack) /*&& CrossbowItem.tryLoadProjectiles(entityliving, itemstack)*/) {
+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND);
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) {
+ if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote();
+ return;
+ }
+ // Paper end
+ // Paper end - Add EntityLoadCrossbowEvent
CrossbowItem.setCharged(stack, true);
SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE;
@@ -28,17 +28,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ @io.papermc.paper.annotation.DoNotUse // Paper
+ @io.papermc.paper.annotation.DoNotUse // Paper - Add EntityLoadCrossbowEvent
private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) {
+ // Paper start
+ // Paper start - Add EntityLoadCrossbowEvent
+ return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true);
+ }
+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) {
+ // Paper end
+ // Paper end - Add EntityLoadCrossbowEvent
int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, crossbow);
int j = i == 0 ? 1 : 3;
- boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild;
+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - add consume
+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - Add EntityLoadCrossbowEvent
ItemStack itemstack1 = shooter.getProjectile(crossbow);
ItemStack itemstack2 = itemstack1.copy();