Block Manipulation

Discussion in 'Plugin Development' started by zakarls, Jun 21, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    zakarls

    So I have a command, /uplift, that you do /uplift <radius> and all entities within that radius will be thrown upwards. I was wondering how I would get it to also pick random blocks in that radius and also throw them up so it looks like the ground "shot up". Thanks for any help :)
     
  2. Offline

    jthort

    zakarls What have you tried so far?
     
  3. Offline

    zakarls

    jthort
    I haven't tried anything yet because I have no clue how to do it. But, This is my other code:
    Code:
    if(commandLabel.equalsIgnoreCase("uplift")){
                if(player.isOp()){
                    int x = Integer.parseInt(args[0]);
                    for(Entity e : player.getNearbyEntities(x, x, x)){
                        Location location = e.getLocation();
                        double pitch = ((location.getPitch() + 90) * Math.PI) / 180;
                        double yaw  = ((location.getYaw() + 90)  * Math.PI) / 180;
                        double x1 = Math.sin(pitch) * Math.cos(yaw);
                        double y = Math.sin(pitch) * Math.sin(yaw);
                        double z = 10;
                        Vector vector = new Vector(x1, z, y);
                        e.setVelocity(vector);
                    }
                }
            }
     
  4. Offline

    zakarls

    Bump. I really need help on this.
     
  5. Offline

    thecrystalflame

    the best way to do this would be to manipulate packets. i have done this before by spawning invisible bats and locking a falling block to that bats position.
     
  6. Offline

    zakarls

    thecrystalflame
    Ok. But im not sure how to do that. Also how would I make it choose random blocks around the player and not all of them.
     
Thread Status:
Not open for further replies.

Share This Page