diff --git a/src/dark/core/prefab/vehicles/EntityDrivable.java b/src/dark/core/prefab/vehicles/EntityDrivable.java index 129f96be..454c47a3 100644 --- a/src/dark/core/prefab/vehicles/EntityDrivable.java +++ b/src/dark/core/prefab/vehicles/EntityDrivable.java @@ -40,7 +40,7 @@ public class EntityDrivable extends EntityAdvanced implements IControlReceiver @Override public boolean keyTyped(EntityPlayer player, int keycode) { - System.out.println("Key: "+keycode+" P: " + (player != null ? player.username : "null")); + System.out.println("Key: " + keycode + " P: " + (player != null ? player.username : "null")); if (player != null && this.riddenByEntity instanceof EntityPlayer && ((EntityPlayer) this.riddenByEntity).username.equalsIgnoreCase(player.username)) { //TODO add auto forward and backwards keys like those in WoT @@ -55,11 +55,11 @@ public class EntityDrivable extends EntityAdvanced implements IControlReceiver } if (keycode == Minecraft.getMinecraft().gameSettings.keyBindLeft.keyCode) { - this.rotationYaw += 6; + this.turn(true); } if (keycode == Minecraft.getMinecraft().gameSettings.keyBindRight.keyCode) { - this.rotationYaw -= 6; + this.turn(false); } //Power brakes if (keycode == Minecraft.getMinecraft().gameSettings.keyBindJump.keyCode) @@ -83,6 +83,8 @@ public class EntityDrivable extends EntityAdvanced implements IControlReceiver double deltaX = Math.cos(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; double deltaZ = Math.sin(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; this.riddenByEntity.setPosition(this.posX + deltaX, this.posY + this.riddenByEntity.getYOffset(), this.posZ + deltaZ); + + this.riddenByEntity.rotationYaw = this.rotationYaw; } } @@ -174,6 +176,18 @@ public class EntityDrivable extends EntityAdvanced implements IControlReceiver } } + public void turn(boolean left) + { + if (left) + { + this.rotationYaw -= 6; + } + else + { + this.rotationYaw += 6; + } + } + /** By default this slows the vehicle down with a constant. However this can be used to apply * advanced friction based on materials */ public void applyFriction()