Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void move(double d0, double d1, double d2) {
- // TODO Auto-generated method stub
- super.move(d0, d1, d2);
- if(this.group!=null || this.getBukkitEntity().getLocation().getDirection()==null || this.getBukkitEntity().getLocation().getDirection() == ZERO)
- {
- if(this.group.getInFrontOfCar(this)!=null)
- {
- CommonMinecart cm = this.group.getInFrontOfCar(this);
- //Cm is the car infront of this car
- Location nextToCar = cm.getBukkitEntity().getLocation()
- .add(cm.getBukkitEntity().getLocation().getDirection().multiply(0));
- double x = Physics.rotateAroundY("x", nextToCar.getX(), nextToCar.getY(), nextToCar.getZ(), cm.locX, cm.locY, cm.locZ, 90);
- double y = Physics.rotateAroundY("y", nextToCar.getX(), nextToCar.getY(), nextToCar.getZ(), cm.locX, cm.locY, cm.locZ, 90);
- double z = Physics.rotateAroundY("z", nextToCar.getX(), nextToCar.getY(), nextToCar.getZ(), cm.locX, cm.locY, cm.locZ, 90);
- Location newLoc = new Location(nextToCar.getWorld(), x, y, z);
- this.getBukkitEntity().setVelocity(newLoc.toVector().subtract(this.getBukkitEntity().getLocation().toVector()));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement