summaryrefslogtreecommitdiffstats
path: root/nms-patches/ItemFlintAndSteel.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/ItemFlintAndSteel.patch')
-rw-r--r--nms-patches/ItemFlintAndSteel.patch14
1 files changed, 7 insertions, 7 deletions
diff --git a/nms-patches/ItemFlintAndSteel.patch b/nms-patches/ItemFlintAndSteel.patch
index ab3aef93..20d31fe8 100644
--- a/nms-patches/ItemFlintAndSteel.patch
+++ b/nms-patches/ItemFlintAndSteel.patch
@@ -14,30 +14,30 @@
@@ -9,13 +14,31 @@
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
+ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
+ BlockPosition clicked = blockposition; // CraftBukkit
blockposition = blockposition.shift(enumdirection);
if (!entityhuman.a(blockposition, enumdirection, itemstack)) {
- return false;
+ return EnumInteractionResult.FAIL;
} else {
- if (world.getType(blockposition).getBlock().getMaterial() == Material.AIR) {
+ if (world.getType(blockposition).getMaterial() == Material.AIR) {
+ // CraftBukkit start - Store the clicked block
+ if (CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) {
+ itemstack.damage(1, entityhuman);
-+ return false;
++ return EnumInteractionResult.PASS;
+ }
+
+ CraftBlockState blockState = CraftBlockState.getBlockState(world, blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ // CraftBukkit end
- world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "fire.ignite", 1.0F, ItemFlintAndSteel.g.nextFloat() * 0.4F + 0.8F);
- world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+ world.a(entityhuman, blockposition, SoundEffects.bw, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.i.nextFloat() * 0.4F + 0.8F);
+ world.setTypeAndData(blockposition, Blocks.FIRE.getBlockData(), 11);
+
+ // CraftBukkit start
+ org.bukkit.event.block.BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clicked.getX(), clicked.getY(), clicked.getZ());
+
+ if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
+ placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false);
-+ return false;
++ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
}