Advertisement
Guest User

Untitled

a guest
May 28th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. @Override
  2. public void move(double d0, double d1, double d2) {
  3. // TODO Auto-generated method stub
  4. super.move(d0, d1, d2);
  5.  
  6. if(this.group!=null || this.getBukkitEntity().getLocation().getDirection()==null || this.getBukkitEntity().getLocation().getDirection() == ZERO)
  7. {
  8. if(this.group.getInFrontOfCar(this)!=null)
  9. {
  10. CommonMinecart cm = this.group.getInFrontOfCar(this);
  11. //Cm is the car infront of this car
  12.  
  13. Location nextToCar = cm.getBukkitEntity().getLocation()
  14. .add(cm.getBukkitEntity().getLocation().getDirection().multiply(0));
  15.  
  16. double x = Physics.rotateAroundY("x", nextToCar.getX(), nextToCar.getY(), nextToCar.getZ(), cm.locX, cm.locY, cm.locZ, 90);
  17. double y = Physics.rotateAroundY("y", nextToCar.getX(), nextToCar.getY(), nextToCar.getZ(), cm.locX, cm.locY, cm.locZ, 90);
  18. double z = Physics.rotateAroundY("z", nextToCar.getX(), nextToCar.getY(), nextToCar.getZ(), cm.locX, cm.locY, cm.locZ, 90);
  19.  
  20. Location newLoc = new Location(nextToCar.getWorld(), x, y, z);
  21.  
  22.  
  23. this.getBukkitEntity().setVelocity(newLoc.toVector().subtract(this.getBukkitEntity().getLocation().toVector()));
  24.  
  25.  
  26. }
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement