SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot
By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
@@ -292,7 +292,7 @@
|
||||
+ cancelledBlock = true;
|
||||
+ }
|
||||
+
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityplayer, Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectpositionblock.getDirection(), itemstack, cancelledBlock, enumhand);
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityplayer, Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectpositionblock.getDirection(), itemstack, cancelledBlock, enumhand, movingobjectpositionblock.getLocation());
|
||||
+ firedInteract = true;
|
||||
+ interactResult = event.useItemInHand() == Event.Result.DENY;
|
||||
+ interactPosition = blockposition.immutable();
|
||||
|
||||
@@ -784,7 +784,7 @@
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.isSameItemSameTags(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ cancelled = player.gameMode.interactResult;
|
||||
+ } else {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand);
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand, movingobjectpositionblock.getLocation());
|
||||
+ cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
+ }
|
||||
+ player.gameMode.firedInteract = false;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
+ // CraftBukkit start - Boat placement
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, enumhand);
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, false, enumhand, movingobjectpositionblock.getLocation());
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResultWrapper.pass(itemstack);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/world/level/block/ChiseledBookShelfBlock.java
|
||||
+++ b/net/minecraft/world/level/block/ChiseledBookShelfBlock.java
|
||||
@@ -128,7 +128,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private static int getHitSlot(Vec2F vec2f) {
|
||||
+ public static int getHitSlot(Vec2F vec2f) { //CraftBukkit - private -> public
|
||||
int i = vec2f.y >= 0.5F ? 0 : 1;
|
||||
int j = getSection(vec2f.x);
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
|
||||
Objects.requireNonNull(blockstatelist_a);
|
||||
list.forEach((iblockstate) -> {
|
||||
- blockstatelist_a.add(iblockstate);
|
||||
+ blockstatelist_a.add((BlockStateBoolean) iblockstate); // CraftBukkit - Decompile error
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user