aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/RedStoneOreBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/RedStoneOreBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/RedStoneOreBlock.java.patch115
1 files changed, 115 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/RedStoneOreBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/RedStoneOreBlock.java.patch
new file mode 100644
index 0000000000..3797f5f059
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/RedStoneOreBlock.java.patch
@@ -0,0 +1,115 @@
+--- a/net/minecraft/world/level/block/RedStoneOreBlock.java
++++ b/net/minecraft/world/level/block/RedStoneOreBlock.java
+@@ -21,6 +21,10 @@
+ import net.minecraft.world.level.block.state.StateDefinition;
+ import net.minecraft.world.level.block.state.properties.BooleanProperty;
+ import net.minecraft.world.phys.BlockHitResult;
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.entity.EntityInteractEvent;
++// CraftBukkit end
+
+ public class RedStoneOreBlock extends Block {
+ public static final MapCodec<RedStoneOreBlock> CODEC = simpleCodec(RedStoneOreBlock::new);
+@@ -37,15 +42,28 @@
+ }
+
+ @Override
+- public void attack(BlockState state, Level level, BlockPos pos, Player player) {
+- interact(state, level, pos);
++ public void attack(IBlockData state, Level level, BlockPos pos, Player player) {
++ interact(state, level, pos, player); // CraftBukkit - add entityhuman
+ super.attack(state, level, pos, player);
+ }
+
+ @Override
+ public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) {
+ if (!entity.isSteppingCarefully()) {
+- interact(state, level, pos);
++ // CraftBukkit start
++ if (entity instanceof Player) {
++ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((Player) entity, org.bukkit.event.block.Action.PHYSICAL, pos, null, null, null);
++ if (!event.isCancelled()) {
++ interact(level.getBlockState(pos), level, pos, entity); // add entity
++ }
++ } else {
++ EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
++ level.getCraftServer().getPluginManager().callEvent(event);
++ if (!event.isCancelled()) {
++ interact(level.getBlockState(pos), level, pos, entity); // add entity
++ }
++ }
++ // CraftBukkit end
+ }
+
+ super.stepOn(level, pos, state, entity);
+@@ -56,7 +74,7 @@
+ if (level.isClientSide) {
+ spawnParticles(level, pos);
+ } else {
+- interact(state, level, pos);
++ interact(state, level, pos, player); // CraftBukkit - add entityhuman
+ }
+
+ ItemStack itemInHand = player.getItemInHand(hand);
+@@ -65,10 +82,15 @@
+ : InteractionResult.SUCCESS;
+ }
+
+- private static void interact(BlockState state, Level level, BlockPos pos) {
+- spawnParticles(level, pos);
+- if (!state.getValue(LIT)) {
+- level.setBlock(pos, state.setValue(LIT, Boolean.valueOf(true)), 3);
++ private static void interact(IBlockData iblockdata, Level world, BlockPos blockposition, Entity entity) { // CraftBukkit - add Entity
++ spawnParticles(world, blockposition);
++ if (!(Boolean) iblockdata.getValue(RedStoneOreBlock.LIT)) {
++ // CraftBukkit start
++ if (!CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata.setValue(RedStoneOreBlock.LIT, true))) {
++ return;
++ }
++ // CraftBukkit end
++ world.setBlock(blockposition, (IBlockData) iblockdata.setValue(RedStoneOreBlock.LIT, true), 3);
+ }
+ }
+
+@@ -78,19 +101,34 @@
+ }
+
+ @Override
+- public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
+- if (state.getValue(LIT)) {
+- level.setBlock(pos, state.setValue(LIT, Boolean.valueOf(false)), 3);
++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
++ if ((Boolean) state.getValue(RedStoneOreBlock.LIT)) {
++ // CraftBukkit start
++ if (CraftEventFactory.callBlockFadeEvent(level, pos, state.setValue(RedStoneOreBlock.LIT, false)).isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
++ level.setBlock(pos, (IBlockData) state.setValue(RedStoneOreBlock.LIT, false), 3);
+ }
+ }
+
+ @Override
+ public void spawnAfterBreak(BlockState state, ServerLevel level, BlockPos pos, ItemStack stack, boolean dropExperience) {
+ super.spawnAfterBreak(state, level, pos, stack, dropExperience);
+- if (dropExperience && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) == 0) {
+- int i = 1 + level.random.nextInt(5);
+- this.popExperience(level, pos, i);
++ // CraftBukkit start - Delegated to getExpDrop
++ }
++
++ @Override
++ public int getExpDrop(IBlockData iblockdata, ServerLevel worldserver, BlockPos blockposition, ItemStack itemstack, boolean flag) {
++ if (flag && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
++ int i = 1 + worldserver.random.nextInt(5);
++
++ // this.popExperience(worldserver, blockposition, i);
++ return i;
+ }
++
++ return 0;
++ // CraftBukkit end
+ }
+
+ @Override