1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
--- a/net/minecraft/world/item/FireChargeItem.java
+++ b/net/minecraft/world/item/FireChargeItem.java
@@ -31,18 +30,34 @@
BlockState blockstate = level.getBlockState(blockpos);
boolean flag = false;
- if (!CampfireBlock.canLight(blockstate) && !CandleBlock.canLight(blockstate) && !CandleCakeBlock.canLight(blockstate)) {
- blockpos = blockpos.relative(useoncontext.getClickedFace());
- if (BaseFireBlock.canBePlacedAt(level, blockpos, useoncontext.getHorizontalDirection())) {
- this.playSound(level, blockpos);
- level.setBlockAndUpdate(blockpos, BaseFireBlock.getState(level, blockpos));
- level.gameEvent((Entity) useoncontext.getPlayer(), GameEvent.BLOCK_PLACE, blockpos);
+ if (!CampfireBlock.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
+ blockposition = blockposition.relative(context.getClickedFace());
+ if (BaseFireBlock.canBePlacedAt(world, blockposition, context.getHorizontalDirection())) {
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, context.getPlayer()).isCancelled()) {
+ if (!context.getPlayer().getAbilities().instabuild) {
+ context.getItemInHand().shrink(1);
+ }
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
+ this.playSound(world, blockposition);
+ world.setBlockAndUpdate(blockposition, BaseFireBlock.getState(world, blockposition));
+ world.gameEvent((Entity) context.getPlayer(), GameEvent.BLOCK_PLACE, blockposition);
flag = true;
}
} else {
- this.playSound(level, blockpos);
- level.setBlockAndUpdate(blockpos, (BlockState) blockstate.setValue(BlockStateProperties.LIT, true));
- level.gameEvent((Entity) useoncontext.getPlayer(), GameEvent.BLOCK_CHANGE, blockpos);
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, context.getPlayer()).isCancelled()) {
+ if (!context.getPlayer().getAbilities().instabuild) {
+ context.getItemInHand().shrink(1);
+ }
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
+ this.playSound(world, blockposition);
+ world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(BlockStateProperties.LIT, true));
+ world.gameEvent((Entity) context.getPlayer(), GameEvent.BLOCK_CHANGE, blockposition);
flag = true;
}
|