readd debugstick check
This commit is contained in:
@@ -1,27 +1,23 @@
|
||||
--- a/net/minecraft/world/item/ThrowablePotionItem.java
|
||||
+++ b/net/minecraft/world/item/ThrowablePotionItem.java
|
||||
@@ -22,11 +_,29 @@
|
||||
@@ -22,11 +_,25 @@
|
||||
public InteractionResult use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
if (level instanceof ServerLevel serverLevel) {
|
||||
- Projectile.spawnProjectileFromRotation(ThrownPotion::new, serverLevel, itemInHand, player, -20.0F, PROJECTILE_SHOOT_POWER, 1.0F);
|
||||
+ // Projectile.spawnProjectileFromRotation(ThrownPotion::new, serverLevel, itemInHand, player, -20.0F, PROJECTILE_SHOOT_POWER, 1.0F);
|
||||
+ // Paper start - PlayerLaunchProjectileEvent
|
||||
+ final Projectile.Delayed<ThrownPotion> thrownPotion = Projectile.spawnProjectileFromRotationDelayed(ThrownPotion::new, serverLevel, itemInHand, player, -20.0F, PROJECTILE_SHOOT_POWER, 1.0F);
|
||||
+ // Paper start - PlayerLaunchProjectileEvent
|
||||
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Projectile) thrownPotion.projectile().getBukkitEntity());
|
||||
+ if (event.callEvent() && thrownPotion.attemptSpawn()) {
|
||||
+ if (event.shouldConsume()) {
|
||||
+ itemInHand.consume(1, player);
|
||||
+ } else if (player instanceof net.minecraft.server.level.ServerPlayer) {
|
||||
+ ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().updateInventory();
|
||||
+ } else {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+
|
||||
+ player.awardStat(Stats.ITEM_USED.get(this));
|
||||
+ } else {
|
||||
+ if (player instanceof net.minecraft.server.level.ServerPlayer) {
|
||||
+ ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ return InteractionResult.FAIL;
|
||||
+ }
|
||||
+ // Paper end - PlayerLaunchProjectileEvent
|
||||
|
||||
Reference in New Issue
Block a user