Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
- {
- world.scheduleBlockUpdate(pos, this, 40, 0);
- double angle = 0;
- Vec3d targetVector = new Vec3d(1, 0, 1);
- BlockPos newPos = getBlockPos(world, pos, targetVector);
- if (world.getBlockState(newPos).getBlock() instanceof BlockFakeLight)
- return;
- world.setBlockState(newPos.add(-targetVector.x, -targetVector.y, -targetVector.z), LightingDynamicsObjects.FAKE_LIGHT.getDefaultState());
- }
- private BlockPos getBlockPos(World world, BlockPos pos, Vec3d targetVector)
- {
- Vec3d start = new Vec3d(pos).add(targetVector).addVector(0.5d, 0.5d, 0.5d);
- Vec3d end = new Vec3d(pos).addVector(0.5d, 0.5d, 0.5d).add(targetVector.scale(4));
- System.out.println("Start: " + start);
- System.out.println("End : " + end);
- RayTraceResult raytrace = world.rayTraceBlocks(start, end, false);
- if (raytrace != null && raytrace.typeOfHit != RayTraceResult.Type.MISS)
- {
- System.out.println("Result:" + raytrace.getBlockPos());
- return raytrace.getBlockPos();
- }
- else
- {
- return new BlockPos(0, 0, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement