aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/item/FireChargeItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/item/FireChargeItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/item/FireChargeItem.java.patch92
1 files changed, 92 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/item/FireChargeItem.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/item/FireChargeItem.java.patch
new file mode 100644
index 0000000000..25fe364878
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/item/FireChargeItem.java.patch
@@ -0,0 +1,92 @@
+--- a/net/minecraft/world/item/FireChargeItem.java
++++ b/net/minecraft/world/item/FireChargeItem.java
+@@ -5,52 +5,73 @@
+ import net.minecraft.sounds.SoundSource;
+ import net.minecraft.util.RandomSource;
+ import net.minecraft.world.InteractionResult;
++import net.minecraft.world.entity.Entity;
++import net.minecraft.world.entity.player.Player;
+ import net.minecraft.world.item.context.UseOnContext;
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.block.BaseFireBlock;
+ 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 properties) {
+ super(properties);
+ }
+
+ @Override
+ public InteractionResult useOn(UseOnContext context) {
+- Level level = context.getLevel();
+- BlockPos clickedPos = context.getClickedPos();
+- BlockState blockState = level.getBlockState(clickedPos);
++ 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 var6 = clickedPos.relative(context.getClickedFace());
+- if (BaseFireBlock.canBePlacedAt(level, var6, context.getHorizontalDirection())) {
+- this.playSound(level, var6);
+- level.setBlockAndUpdate(var6, BaseFireBlock.getState(level, var6));
+- level.gameEvent(context.getPlayer(), GameEvent.BLOCK_PLACE, var6);
++
++ 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, clickedPos);
+- level.setBlockAndUpdate(clickedPos, blockState.setValue(BlockStateProperties.LIT, Boolean.valueOf(true)));
+- level.gameEvent(context.getPlayer(), GameEvent.BLOCK_CHANGE, clickedPos);
++ // 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) {
+ context.getItemInHand().shrink(1);
+- return InteractionResult.sidedSuccess(level.isClientSide);
++ return InteractionResult.sidedSuccess(world.isClientSide);
+ } else {
+ return InteractionResult.FAIL;
+ }
+ }
+
+ private void playSound(Level level, BlockPos pos) {
+- RandomSource random = level.getRandom();
+- level.playSound(null, pos, SoundEvents.FIRECHARGE_USE, SoundSource.BLOCKS, 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
++ RandomSource randomsource = level.getRandom();
++
++ level.playSound((Player) null, pos, SoundEvents.FIRECHARGE_USE, SoundSource.BLOCKS, 1.0F, (randomsource.nextFloat() - randomsource.nextFloat()) * 0.2F + 1.0F);
+ }
+ }