aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/item/FireChargeItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/FireChargeItem.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/item/FireChargeItem.java.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/FireChargeItem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/FireChargeItem.java.patch
new file mode 100644
index 0000000000..fffc0310e0
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/FireChargeItem.java.patch
@@ -0,0 +1,89 @@
+--- a/net/minecraft/world/item/FireChargeItem.java
++++ b/net/minecraft/world/item/FireChargeItem.java
+@@ -13,50 +13,65 @@
+ import net.minecraft.world.level.block.CampfireBlock;
+ import net.minecraft.world.level.block.CandleBlock;
+ import net.minecraft.world.level.block.CandleCakeBlock;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
+ import net.minecraft.world.level.gameevent.GameEvent;
+
+ public class FireChargeItem extends Item {
+
+- public FireChargeItem(Item.Properties item_properties) {
+- super(item_properties);
++ public FireChargeItem(Item.Properties properties) {
++ super(properties);
+ }
+
+ @Override
+- @Override
+- public InteractionResult useOn(UseOnContext useoncontext) {
+- Level level = useoncontext.getLevel();
+- BlockPos blockpos = useoncontext.getClickedPos();
+- BlockState blockstate = level.getBlockState(blockpos);
++ public InteractionResult useOn(UseOnContext context) {
++ Level world = context.getLevel();
++ BlockPos blockposition = context.getClickedPos();
++ IBlockData iblockdata = world.getBlockState(blockposition);
+ 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;
+ }
+
+ if (flag) {
+- useoncontext.getItemInHand().shrink(1);
+- return InteractionResult.sidedSuccess(level.isClientSide);
++ context.getItemInHand().shrink(1);
++ return InteractionResult.sidedSuccess(world.isClientSide);
+ } else {
+ return InteractionResult.FAIL;
+ }
+ }
+
+- private void playSound(Level level, BlockPos blockpos) {
++ private void playSound(Level level, BlockPos pos) {
+ RandomSource randomsource = level.getRandom();
+
+- level.playSound((Player) null, blockpos, SoundEvents.FIRECHARGE_USE, SoundSource.BLOCKS, 1.0F, (randomsource.nextFloat() - randomsource.nextFloat()) * 0.2F + 1.0F);
++ level.playSound((Player) null, pos, SoundEvents.FIRECHARGE_USE, SoundSource.BLOCKS, 1.0F, (randomsource.nextFloat() - randomsource.nextFloat()) * 0.2F + 1.0F);
+ }
+ }