diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/DragonEggBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/DragonEggBlock.java.patch | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/DragonEggBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/DragonEggBlock.java.patch new file mode 100644 index 0000000000..5aae14af92 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/DragonEggBlock.java.patch @@ -0,0 +1,125 @@ +--- a/net/minecraft/world/level/block/DragonEggBlock.java ++++ b/net/minecraft/world/level/block/DragonEggBlock.java +@@ -4,18 +4,19 @@ + import net.minecraft.core.BlockPos; + import net.minecraft.core.particles.ParticleTypes; + import net.minecraft.util.Mth; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.level.BlockGetter; + import net.minecraft.world.level.Level; + import net.minecraft.world.level.block.state.BlockBehaviour; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.border.WorldBorder; +-import net.minecraft.world.level.pathfinder.PathComputationType; ++import net.minecraft.world.level.pathfinder.PathMode; + import net.minecraft.world.phys.BlockHitResult; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.VoxelShape; ++import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit + + public class DragonEggBlock extends FallingBlock { + +@@ -23,56 +24,64 @@ + protected static final VoxelShape SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D); + + @Override +- @Override + public MapCodec<DragonEggBlock> codec() { + return DragonEggBlock.CODEC; + } + +- public DragonEggBlock(BlockBehaviour.Properties blockbehaviour_properties) { +- super(blockbehaviour_properties); ++ public DragonEggBlock(BlockBehaviour.Properties properties) { ++ super(properties); + } + + @Override +- @Override +- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { ++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { + return DragonEggBlock.SHAPE; + } + + @Override +- @Override +- public InteractionResult use(BlockState blockstate, Level level, BlockPos blockpos, Player player, InteractionHand interactionhand, BlockHitResult blockhitresult) { +- this.teleport(blockstate, level, blockpos); ++ public InteractionResult use(IBlockData state, Level level, BlockPos pos, Player player, EnumHand hand, BlockHitResult hit) { ++ this.teleport(state, level, pos); + return InteractionResult.sidedSuccess(level.isClientSide); + } + + @Override +- @Override +- public void attack(BlockState blockstate, Level level, BlockPos blockpos, Player player) { +- this.teleport(blockstate, level, blockpos); ++ public void attack(IBlockData state, Level level, BlockPos pos, Player player) { ++ this.teleport(state, level, pos); + } + +- private void teleport(BlockState blockstate, Level level, BlockPos blockpos) { ++ private void teleport(IBlockData state, Level level, BlockPos pos) { + WorldBorder worldborder = level.getWorldBorder(); + + for (int i = 0; i < 1000; ++i) { +- BlockPos blockpos1 = blockpos.offset(level.random.nextInt(16) - level.random.nextInt(16), level.random.nextInt(8) - level.random.nextInt(8), level.random.nextInt(16) - level.random.nextInt(16)); ++ BlockPos blockposition1 = pos.offset(level.random.nextInt(16) - level.random.nextInt(16), level.random.nextInt(8) - level.random.nextInt(8), level.random.nextInt(16) - level.random.nextInt(16)); + +- if (level.getBlockState(blockpos1).isAir() && worldborder.isWithinBounds(blockpos1)) { ++ if (level.getBlockState(blockposition1).isAir() && worldborder.isWithinBounds(blockposition1)) { ++ // CraftBukkit start ++ org.bukkit.block.Block from = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); ++ org.bukkit.block.Block to = level.getWorld().getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()); ++ BlockFromToEvent event = new BlockFromToEvent(from, to); ++ org.bukkit.Bukkit.getPluginManager().callEvent(event); ++ ++ if (event.isCancelled()) { ++ return; ++ } ++ ++ blockposition1 = new BlockPos(event.getToBlock().getX(), event.getToBlock().getY(), event.getToBlock().getZ()); ++ // CraftBukkit end + if (level.isClientSide) { + for (int j = 0; j < 128; ++j) { + double d0 = level.random.nextDouble(); + float f = (level.random.nextFloat() - 0.5F) * 0.2F; + float f1 = (level.random.nextFloat() - 0.5F) * 0.2F; + float f2 = (level.random.nextFloat() - 0.5F) * 0.2F; +- double d1 = Mth.lerp(d0, (double) blockpos1.getX(), (double) blockpos.getX()) + (level.random.nextDouble() - 0.5D) + 0.5D; +- double d2 = Mth.lerp(d0, (double) blockpos1.getY(), (double) blockpos.getY()) + level.random.nextDouble() - 0.5D; +- double d3 = Mth.lerp(d0, (double) blockpos1.getZ(), (double) blockpos.getZ()) + (level.random.nextDouble() - 0.5D) + 0.5D; ++ double d1 = Mth.lerp(d0, (double) blockposition1.getX(), (double) pos.getX()) + (level.random.nextDouble() - 0.5D) + 0.5D; ++ double d2 = Mth.lerp(d0, (double) blockposition1.getY(), (double) pos.getY()) + level.random.nextDouble() - 0.5D; ++ double d3 = Mth.lerp(d0, (double) blockposition1.getZ(), (double) pos.getZ()) + (level.random.nextDouble() - 0.5D) + 0.5D; + + level.addParticle(ParticleTypes.PORTAL, d1, d2, d3, (double) f, (double) f1, (double) f2); + } + } else { +- level.setBlock(blockpos1, blockstate, 2); +- level.removeBlock(blockpos, false); ++ level.setBlock(blockposition1, state, 2); ++ level.removeBlock(pos, false); + } + + return; +@@ -82,14 +91,12 @@ + } + + @Override +- @Override + protected int getDelayAfterPlace() { + return 5; + } + + @Override +- @Override +- public boolean isPathfindable(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, PathComputationType pathcomputationtype) { ++ public boolean isPathfindable(IBlockData state, BlockGetter level, BlockPos pos, PathMode type) { + return false; + } + } |