Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- velocity = new Vector(0,0,0);
- Vector finalVector;
- Location newBlockLocation = null;
- Block skylineBlock;
- World playerWorld = player.getWorld();
- while (!(player.isSneaking())) {
- Location skylinePosition;
- Location skylinePositionM;
- playerLocation = player.getLocation();
- if (newBlockLocation == null) {
- newBlockLocation = blockLocation;
- } else {
- newBlockLocation = playerLocation.clone().add(0, 2, 0);
- }
- int vX = velocity.getBlockX();
- int vZ = velocity.getBlockZ();
- finalVector = null;
- if (vX == 0 && vZ == 0) {
- player.sendMessage(ChatColor.YELLOW + "Boucle 1");
- skylinePosition = newBlockLocation.clone().add(-1, -1, -1);
- skylinePositionM = newBlockLocation.clone().add(1,1,1);
- int xM = skylinePositionM.getBlockX();
- for (int x=skylinePosition.getBlockX();x<=xM;x++) {
- int yM = skylinePositionM.getBlockY();
- player.sendMessage(ChatColor.YELLOW + "for x = " + x);
- for (int y=skylinePosition.getBlockY();y<=yM;y++) {
- int zM = skylinePositionM.getBlockZ();
- player.sendMessage(ChatColor.YELLOW + "for y = " + y);
- for (int z=skylinePosition.getBlockZ();z<=zM;z++) {
- player.sendMessage(ChatColor.YELLOW + "for z = " + z);
- skylineBlock = playerWorld.getBlockAt(x,y,z);
- if (skylineBlock.getLocation() == newBlockLocation) {
- } else
- if (items.contains(skylineBlock.getType())) {
- listLocation.add(skylineBlock.getLocation()); //DOESN'T WORK SHIT. (nullpointerexception)
- if (listLocation.size() == 2) {
- Vector vec1 = ((listLocation.get(0)).clone().subtract(skylinePosition)).toVector();
- Vector vec2 = ((listLocation.get(1)).clone().subtract(skylinePosition)).toVector();
- if (vec1.angle(playerDir) <= Math.PI/2 || vec1.angle(playerDir) > -Math.PI/2) {
- finalVector = vec1;
- } else {
- finalVector = vec2;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement