diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/DragonEggBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/level/block/DragonEggBlock.java.patch | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/DragonEggBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/DragonEggBlock.java.patch new file mode 100644 index 0000000000..aefc8a6286 --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/DragonEggBlock.java.patch @@ -0,0 +1,127 @@ +--- a/net/minecraft/world/level/block/DragonEggBlock.java ++++ b/net/minecraft/world/level/block/DragonEggBlock.java +@@ -4,26 +4,28 @@ + 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 { ++ + public static final MapCodec<DragonEggBlock> CODEC = simpleCodec(DragonEggBlock::new); +- protected static final VoxelShape SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); ++ protected static final VoxelShape SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D); + + @Override + public MapCodec<DragonEggBlock> codec() { +- return CODEC; ++ return DragonEggBlock.CODEC; + } + + public DragonEggBlock(BlockBehaviour.Properties properties) { +@@ -31,50 +33,61 @@ + } + + @Override +- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { +- return SHAPE; ++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { ++ return DragonEggBlock.SHAPE; + } + + @Override +- public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ++ 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 +- public void attack(BlockState state, Level level, BlockPos pos, Player player) { ++ public void attack(IBlockData state, Level level, BlockPos pos, Player player) { + this.teleport(state, level, pos); + } + +- private void teleport(BlockState state, Level level, BlockPos pos) { +- WorldBorder worldBorder = level.getWorldBorder(); ++ private void teleport(IBlockData state, Level level, BlockPos pos) { ++ WorldBorder worldborder = level.getWorldBorder(); + +- for (int i = 0; i < 1000; i++) { +- BlockPos blockPos = 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(blockPos).isAir() && worldBorder.isWithinBounds(blockPos)) { ++ for (int i = 0; i < 1000; ++i) { ++ 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(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 i1 = 0; i1 < 128; i1++) { +- double randomDouble = level.random.nextDouble(); ++ 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 d = Mth.lerp(randomDouble, (double)blockPos.getX(), (double)pos.getX()) + (level.random.nextDouble() - 0.5) + 0.5; +- double d1 = Mth.lerp(randomDouble, (double)blockPos.getY(), (double)pos.getY()) + level.random.nextDouble() - 0.5; +- double d2 = Mth.lerp(randomDouble, (double)blockPos.getZ(), (double)pos.getZ()) + (level.random.nextDouble() - 0.5) + 0.5; +- level.addParticle(ParticleTypes.PORTAL, d, d1, d2, (double)f, (double)f1, (double)f2); ++ 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(blockPos, state, 2); ++ level.setBlock(blockposition1, state, 2); + level.removeBlock(pos, false); + } + + return; + } + } ++ + } + + @Override +@@ -83,7 +96,7 @@ + } + + @Override +- public boolean isPathfindable(BlockState state, BlockGetter level, BlockPos pos, PathComputationType type) { ++ public boolean isPathfindable(IBlockData state, BlockGetter level, BlockPos pos, PathMode type) { + return false; + } + } |