gt: 		if(f > 135F && f <= 225F) {
context: package mod_HeavyVehicles.common;
  
  import java.util.*;
  import mod_Garages.common.mod_Garages;
  import mod_HLights.common.mod_HLights;
  import mod_HeavyVehicles.client.GuiHeavyVehicle;
  import mod_Metalworks.common.mod_Metalworks;
  import mod_Rways.common.mod_Rways;
  import net.minecraft.client.Minecraft;
  import net.minecraft.src.AxisAlignedBB;
  import net.minecraft.src.Block;
  import net.minecraft.src.DamageSource;
  import net.minecraft.src.Entity;
  import net.minecraft.src.EntityItem;
  import net.minecraft.src.EntityPlayer;
  import net.minecraft.src.EntityWolf;
  import net.minecraft.src.IInventory;
  import net.minecraft.src.Item;
  import net.minecraft.src.ItemStack;
  import net.minecraft.src.Material;
  import net.minecraft.src.MathHelper;
  import net.minecraft.src.ModLoader;
  import net.minecraft.src.NBTTagCompound;
  import net.minecraft.src.NBTTagList;
  import net.minecraft.src.Render;
  import net.minecraft.src.World;
  
  import org.lwjgl.input.Keyboard;
  
  public class EntityHeavyVehicle extends Entity implements IInventory, IFuelable {
  
  	public EntityHeavyVehicle(World world) {
  		super(world);
  		timeSinceHit = 0;
  		rockDirection = 1;
  		preventEntitySpawning = true;
  		blockCheck = 4;
  		stepHeight = 1.0F;
  		yOffset = height / 2.0F - 0.17F;
  		motionX = 0.0D;
  		motionY = 0.0D;
  		motionZ = 0.0D;
  		speed = 0.0D;
  		accelerating = false;
  		wheelYaw = 0.0F;
  		shootDelay = 0;
  		shellDelay = 0;
  		maxHealth = 2000;
  		maxFuel = 12000;
  		vehicleFuel = 0;
  		maxAmmo = 100;
  		vehicleAmmo = 0;
  		rotationRoll = 0.0F;
  		numCargoRows = 2;
  		inventorySize = numCargoRows * 5 + 1;
  		cargoItems = new ItemStack[inventorySize];
  		numGunners = 0;
  		GunnerSeats = new EntityGunnerSeat[numGunners];
  		playerXOffset = 0.0D;
  		playerYOffset = 0.0D;
  		playerZOffset = 0.0D;
  		gunYaw = 0.0F;
  		gunPitch = 0.0F;
  		barrelLength = 0;
  		// ignoreFrustrumCheck = true;
  		drillOn = false;
  		drillCounter = 0;
  		paverOn = false;
  		paverAngle = 80F;
  		refuelRate = 0;
  	}
  
  	public void startup( ) {
  		for(int i = 0 ; i < numGunners ; i++) {
  			if(worldObj != null) {
  				worldObj.spawnEntityInWorld(GunnerSeats[i]);
  			}
  		}
  
  		inventorySize = numCargoRows * 5 + 1;
  		cargoItems = new ItemStack[inventorySize];
  		dropItem = vehicle.shiftedIndex;
  	}
  	@Override
  	public void setPosition(double d, double d1, double d2) {
  		posX = d;
  		posY = d1;
  		posZ = d2;
  		float f = width / 2.0F;
  		float f1 = height;
  		boundingBox.setBounds(d - (double)f, (d1 - (double)yOffset) + (double)ySize, d2 - (double)f, d + (double)f, (d1 - (double)yOffset) + (double)ySize + (double)f1, d2 + (double)f);
  	}
  	@Override
  	protected void entityInit( ) {}
  	@Override
  	public AxisAlignedBB getCollisionBox(Entity entity) {
  		return entity.boundingBox;
  	}
  	@Override
  	public AxisAlignedBB getBoundingBox( ) {
  		return boundingBox;
  	}
  	@Override
  	public boolean canBePushed( ) {
  		if (!isInWater()) {
  			return false;
  		} else {
  			return true;
  		}
  	}
  
  	public EntityHeavyVehicle(World world, double d, double d1, double d2) {
  		this(world);
  		setPosition(d, d1 + (double)yOffset, d2);
  		motionX = 0.0D;
  		motionY = 0.0D;
  		motionZ = 0.0D;
  		prevPosX = d;
  		prevPosY = d1;
  		prevPosZ = d2;
  	}
  
  	public EntityHeavyVehicle(World world, double d, double d1, double d2, EntityPlayer entityplayer, int i) {
  		this(world);
  		setPosition(d, d1 + (double)yOffset, d2);
  		motionX = 0.0D;
  		motionY = 0.0D;
  		motionZ = 0.0D;
  		rotationYaw = entityplayer.rotationYaw;
  		prevPosX = d;
  		prevPosY = d1;
  		prevPosZ = d2;
  	}
  	@Override
  	public double getMountedYOffset( ) {
  		return playerYOffset;
  	}
  	@Override
  	public boolean attackEntityFrom(DamageSource damagesource, int i) {
  		if(isDead) {
  			return true;
  		}
  		if(timeSinceHit == 0) {
  			performHurtAnimation();
  			setBeenAttacked();
  			vehicleHealth -= 10 * i;
  			if(vehicleHealth <= 0) {
  				destroyVehicle();
  			}
  		}
  		return true;
  	}
  
  	public void destroyVehicle( ) {
  		if(!worldObj.isRemote) {
  			setEntityDead();
  			worldObj.createExplosion(this, posX, posY, posZ, 2.0F);
  			for(int i = 0 ; i < smashItems.length ; i++) {
  				if(smashItems[i] != 0) {
  					dropItemWithOffset(smashItems[i], 1, 0.0F);
  				}
  			}
  
  			entityDropItem(new ItemStack(Item.dyePowder, 1, dyeColor), 0.0F);
  		}
  	}
  
  	public void renderDamage( ) {
  		if(10 * vehicleHealth < maxHealth) {
  			worldObj.spawnParticle("smoke", posX + engineXOffset * Math.cos(((double)rotationYaw * 3.1415926535897931D) / 180D) + (0.80000000000000004D * (double)rand.nextFloat() - 0.40000000000000002D), posY + engineYOffset, posZ + engineXOffset * Math.sin(((double)rotationYaw * 3.1415926535897931D) / 180D) + (0.80000000000000004D * (double)rand.nextFloat() - 0.40000000000000002D), motionX, 0.10000000000000001D, motionZ);
  			worldObj.spawnParticle("flame", posX + engineXOffset * Math.cos(((double)rotationYaw * 3.1415926535897931D) / 180D) + (0.59999999999999998D * (double)rand.nextFloat() - 0.29999999999999999D), posY + engineYOffset, posZ + engineXOffset * Math.sin(((double)rotationYaw * 3.1415926535897931D) / 180D) + (0.59999999999999998D * (double)rand.nextFloat() - 0.29999999999999999D), motionX, 0.050000000000000003D, motionZ);
  		}
  	}
  
  	public void setEntityDead( ) {
  		if(!worldObj.isRemote) {
  			label0:
  			for(int i = 0 ; i < getSizeInventory() ; i++) {
  				ItemStack itemstack = getStackInSlot(i);
  				if(itemstack == null) {
  					continue;
  				}
  				float f = rand.nextFloat() * 0.8F + 0.1F;
  				float f1 = rand.nextFloat() * 0.8F + 0.1F;
  				float f2 = rand.nextFloat() * 0.8F + 0.1F;
  				do {
  					if(itemstack.stackSize <= 0) {
  						continue label0;
  					}
  					int k = rand.nextInt(21) + 10;
  					if(k > itemstack.stackSize) {
  						k = itemstack.stackSize;
  					}
  					itemstack.stackSize -= k;
  					EntityItem entityitem = new EntityItem(worldObj, posX + (double)f, posY + (double)f1, posZ + (double)f2, new ItemStack(itemstack.itemID, k, itemstack.getItemDamage()));
  					float f3 = 0.05F;
  					entityitem.motionX = (float)rand.nextGaussian() * f3;
  					entityitem.motionY = (float)rand.nextGaussian() * f3 + 0.2F;
  					entityitem.motionZ = (float)rand.nextGaussian() * f3;
  					worldObj.spawnEntityInWorld(entityitem);
  				} while(true);
  			}
  
  		}
  		for(int j = 0 ; j < numGunners ; j++) {
  			GunnerSeats[j].setEntityDead();
  		}
  
  		super.setDead();
  	}
  	@Override
  	public void performHurtAnimation( ) {
  		rockDirection = -rockDirection;
  		rotationRoll = rockDirection * 5;
  		timeSinceHit = 10;
  		if(rockDirection > 0) {
  			worldObj.playSoundAtEntity(this, "impactA", 1.0F, 1.0F);
  		} else {
  			worldObj.playSoundAtEntity(this, "impactB", 1.0F, 1.0F);
  		}
  	}
  	@Override
  	public boolean canBeCollidedWith( ) {
  		return !isDead;
  	}
  	@Override
  	public void setPositionAndRotation2(double d, double d1, double d2, float f, float f1, int i) {
  		boatX = d;
  		boatY = d1;
  		boatZ = d2;
  		boatYaw = f;
  		boatPitch = f1;
  		boatPosRotationIncrements = i + 4;
  		motionX = velocityX;
  		motionY = velocityY;
  		motionZ = velocityZ;
  	}
  	@Override
  	public void setVelocity(double d, double d1, double d2) {
  		velocityX = motionX = d;
  		velocityY = motionY = d1;
  		velocityZ = motionZ = d2;
  	}
  
  	public double getSpeed( ) {
  		return Math.sqrt(motionX * motionX + motionZ * motionZ);
  	}
  
  	public void pressKey(int i) {
  		// TODO: Uncomment this if you fixed pressKey and SendKey
  		// mod_HeavyVehicles.pressKey(i);
  		double d = getSpeed();
  		if(d < 0.0D) {
  			d = 0.0D;
  		}
  		if(vehicleHealth > 0) {
  			switch(i) {
  				case 7: // Open Inventory
  				case 8: // Exit Vehicle
  				default:
  					break;
  
  				case 0: // Activate special
  					drillOn = hasDrill ? !drillOn : false;
  					paverOn = hasPaver ? !paverOn : false;
  					ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Special mode activated.");
  					worldObj.playSoundAtEntity(this, shootSound, 1.0F, 1.0F);
  					// fall through
  
  				case 1: // Turn left
  					wheelYaw -= 2D * ((maxSpeed * 2D - d) * turnLeftModifier);
  					if(getSpeed() / maxSpeed > 0.20000000000000001D) {
  						rotationRoll += 3D * (getSpeed() / maxSpeed - 0.20000000000000001D);
  					}
  					break;
  
  				case 2: // Open garage
  					int dir = ((MathHelper.floor_double((double)((riddenByEntity.rotationYaw * 4F) / 360F) + 0.5D) & 3) + 1) % 4;
  					int Gi = MathHelper.floor_double(riddenByEntity.posX);
  					int Gj = MathHelper.floor_double(riddenByEntity.posY);
  					int Gk = MathHelper.floor_double(riddenByEntity.posZ);
  					int maxRange = 32;
  					int vertRange = 3;
  					switch(dir) {
  						case 0:
  							for(int x = Gi ; x < Gi + maxRange ; x++) {
  								for(int y = Gj + vertRange ; y > Gj - vertRange ; y--) {
  									if(worldObj.getBlockId(x, y, Gk) == mod_Garages.Garage.blockID) {
  										mod_Garages.Garage.onBlockActivated(worldObj, x, y, Gk, (EntityPlayer)riddenByEntity, 0, 0, 0, 0);
  									}
  								}
  							}
  							break;
  						case 1:
  							for(int z = Gk ; z < Gk + maxRange ; z++) {
  								for(int y = Gj + vertRange ; y > Gj - vertRange ; y--) {
  									if(worldObj.getBlockId(Gi, y, z) == mod_Garages.Garage.blockID) {
  										mod_Garages.Garage.onBlockActivated(worldObj, Gi, y, z, (EntityPlayer)riddenByEntity, 0, 0, 0, 0);
  									}
  								}
  							}
  							break;
  						case 2:
  							for(int x = Gi ; x > Gi - maxRange ; x--) {
  								for(int y = Gj + vertRange ; y > Gj - vertRange ; y--) {
  									if(worldObj.getBlockId(x, y, Gk) == mod_Garages.Garage.blockID) {
  										mod_Garages.Garage.onBlockActivated(worldObj, x, y, Gk, (EntityPlayer)riddenByEntity, 0, 0, 0, 0);
  									}
  								}
  							}
  							break;
  						case 3:
  							for(int z = Gk ; z > Gk - maxRange ; z--) {
  								for(int y = Gj + vertRange ; y > Gj - vertRange ; y--) {
  									if(worldObj.getBlockId(Gi, y, z) == mod_Garages.Garage.blockID) {
  										mod_Garages.Garage.onBlockActivated(worldObj, Gi, y, z, (EntityPlayer)riddenByEntity, 0, 0, 0, 0);
  									}
  								}
  							}
  							break;
  					}
  				case 3: // Turn Right
  					wheelYaw += 2D * ((maxSpeed * 2D - d) * turnRightModifier);
  					if(getSpeed() / maxSpeed > 0.5D) {
  						rotationRoll -= 3D * (getSpeed() / maxSpeed - 0.20000000000000001D);
  					}
  					break;
  
  				case 4: // Accelerate
  					if(vehicleFuel > 0 || worldObj.isRemote) {
  						speed += 0.02D * acceleration;
  						accelerating = true;
  					}
  					if(getSpeed() / maxSpeed < 0.75D) {
  						rotationPitch += 2D * (1.0D - Math.sqrt(getSpeed() / maxSpeed));
  					}
  					break;
  
  				case 5: // Decelerate
  					if(vehicleFuel > 0 || worldObj.isRemote) {
  						speed -= 0.02D * acceleration;
  						accelerating = true;
  					}
  					if(getSpeed() / maxSpeed > 0.25D) {
  						rotationPitch -= 2D * (getSpeed() / maxSpeed);
  					}
  					break;
  
  				case 6: // Guide to grid
  					int vehicleDir = ((MathHelper.floor_double((double)((riddenByEntity.rotationYaw * 4F) / 360F) + 0.5D)) + 1);
  					//TODO: Remove this debug message!
  					ModLoader.getMinecraftInstance().thePlayer.addChatMessage("RotationYaw: "+rotationYaw+"     vehicleDir: "+vehicleDir);
  					rotationYaw = (rotationYaw - 90 * vehicleDir) * 0.9F + 90 * vehicleDir;
  
  				case 9: // Fire guns
  					if(worldObj.isRemote || shootDelay > 0 || !hasGuns) {
  						break;
  					}
  					int k2 = 0;
  					for(int l3 = 1 ; l3 < numCargoRows + 1 ; l3++) {}
  					if(k2 != 0) {
  						double d1 = (double)barrelX / 16D;
  						double d2 = 0.0D;
  						double d4 = (double)barrelZ / 16D;
  						double d6 = Math.cos(((double)(-rotationYaw) / 180D) * 3.1415926535897931D);
  						double d8 = Math.sin(((double)(-rotationYaw) / 180D) * 3.1415926535897931D);
  						double d10 = Math.cos(((double)rotationPitch / 180D) * 3.1415926535897931D);
  						double d12 = Math.sin(((double)rotationPitch / 180D) * 3.1415926535897931D);
  						double d14 = (d1 * d10 - d2 * d12) * d6 + d4 * d8;
  						double d16 = d1 * d12 + d2 * d10;
  						double d18 = (d2 * d12 - d1 * d10) * d8 + d4 * d6;
  						d1 -= 3D;
  						double d20 = (d1 * d10 - d2 * d12) * d6 + d4 * d8 + rand.nextGaussian() / 100D;
  						double d22 = d1 * d12 + d2 * d10 + rand.nextGaussian() / 100D;
  						double d23 = (d2 * d12 - d1 * d10) * d8 + d4 * d6 + rand.nextGaussian() / 100D;
  						worldObj.playSoundAtEntity(this, shootSound, 1.0F, 1.0F);
  						shootDelay = vehicleShootDelay;
  						barrelZ = -barrelZ;
  						decrStackSize(k2, 1);
  					}
  					break;
  
  				case 10: // Fire Shell
  					if(worldObj.isRemote || shellDelay > 0 || !hasTurret) {
  						break;
  					}
  					int i4 = 0;
  					boolean flag = false;
  					for(int j4 = 0 ; j4 < 5 * numCargoRows + 1 ; j4++) {}
  					if(i4 != 0) {
  						double d3 = (double)shellXOffset / 16D;
  						double d5 = 0.0D;
  						double d7 = (double)shellZOffset / 16D;
  						double d9 = Math.cos(((double)(-(rotationYaw + gunYaw)) / 180D) * 3.1415926535897931D);
  						double d11 = Math.sin(((double)(-(rotationYaw + gunYaw)) / 180D) * 3.1415926535897931D);
  						double d13 = Math.cos(((double)(-(rotationPitch + gunPitch)) / 180D) * 3.1415926535897931D);
  						double d15 = Math.sin(((double)(-(rotationPitch + gunPitch)) / 180D) * 3.1415926535897931D);
  						double d17 = (d3 * d13 - d5 * d15) * d9 + d7 * d11;
  						double d19 = d3 * d15 + d5 * d13;
  						double d21 = (d5 * d15 - d3 * d13) * d11 + d7 * d9;
  						worldObj.playSoundAtEntity(this, shootSound, 1.0F, 1.0F);
  						decrStackSize(i4, 1);
  						shellDelay = vehicleShellDelay;
  					}
  					break;
  			}
  		}
  		if(!worldObj.isRemote && i == 7) {
  			ModLoader.openGUI((EntityPlayer)riddenByEntity, new GuiHeavyVehicle(((EntityPlayer)riddenByEntity).inventory, this));
  		}
  		if(i == 8) {
  			for(int k = 0 ; k < numGunners ; k++) {
  				if(!(GunnerSeats[k].riddenByEntity instanceof EntityWolf)) {
  					continue;
  				}
  				EntityWolf entitywolf = (EntityWolf)GunnerSeats[k].riddenByEntity;
  				if(entitywolf.isTamed() && ((EntityPlayer)riddenByEntity) != null && entitywolf.getOwner() != null && ((EntityPlayer)riddenByEntity) == entitywolf.getOwner()) {
  					entitywolf.mountEntity(GunnerSeats[k]);
  				}
  			}
  
  			riddenByEntity.ridingEntity = null;
  			riddenByEntity.setLocationAndAngles(posX, boundingBox.minY, posZ, rotationYaw, rotationPitch);
  			riddenByEntity = null;
  			if(vehicleFuel > 0 && refuelRate == 0) {
  				worldObj.playSoundAtEntity(this, stopSound, 1.0F, 1.0F);
  			}
  		}
  	}
  	@Override
  	public void onUpdate( ) {
  		super.onUpdate();
  		for(int i = 0 ; i < numGunners ; i++) {
  			GunnerSeats[i].updatePlanePosition(posX, posY, posZ, rotationYaw, rotationPitch);
  		}
  
  		prevPosX = posX;
  		prevPosY = posY;
  		prevPosZ = posZ;
  		accelerating = false;
  		timeSinceHit = timeSinceHit <= 0 ? 0 : timeSinceHit - 1;
  		startSoundTimer = startSoundTimer <= 0 ? 0 : startSoundTimer - 1;
  		idleSoundTimer = idleSoundTimer <= 0 ? 0 : idleSoundTimer - 1;
  		driveSoundTimer = driveSoundTimer <= 0 ? 0 : driveSoundTimer - 1;
  		refuelRate = refuelRate <= 0 || vehicleFuel < maxFuel ? refuelRate : 0;
  		vehicleFuel += refuelRate;
  		vehicleFuel = Math.max(0, Math.min(vehicleFuel, maxFuel));
  		vehicleAmmo = Math.max(0, Math.min(vehicleAmmo, maxAmmo));
  		vehicleHealth = Math.max(0, Math.min(vehicleHealth, maxHealth));
  		vehicleHealth = 10 * vehicleHealth >= maxHealth ? vehicleHealth : vehicleHealth - 1;
  		renderDamage();
  		if(vehicleHealth <= 0) {
  			destroyVehicle();
  		}
  		Minecraft minecraft = ModLoader.getMinecraftInstance();
  		System.out.println("break 1");
  		if(minecraft.thePlayer.ridingEntity != null && minecraft.thePlayer.ridingEntity == this) {
  			System.out.println("break 2");
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_SPECIAL) && timeSinceHit == 0) {
  				System.out.println("break 3");
  				timeSinceHit = 10;
  				pressKey(0);
  			}
  			System.out.println("break 4");
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_TURNLEFT) && refuelRate == 0) {
  				pressKey(1);
  			}
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_GARAGE) && timeSinceHit == 0) {
  				timeSinceHit = 10;
  				pressKey(2);
  			}
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_TURNRIGHT) && refuelRate == 0) {
  				pressKey(3);
  			}
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_ACC) && refuelRate == 0) {
  				pressKey(4);
  			}
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_DEC) && refuelRate == 0) {
  				pressKey(5);
  			}
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_GUIDE) && refuelRate == 0) {
  				pressKey(6);
  			}
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_INV)) {
  				pressKey(7);
  			}
  			if(Keyboard.isKeyDown(mod_HeavyVehicles.KEY_GETOUT)) {
  				pressKey(8);
  			}
  		}
  		System.out.println("break 5");
  		if(!accelerating) {
  			speed *= 0.9;
  		}
  		motionX = speed * Math.cos(rotationYaw * (Math.PI / 180.0));
  		motionZ = speed * Math.sin(rotationYaw * (Math.PI / 180.0));
  		if(vehicleFuel < maxFuel && riddenByEntity != null && !worldObj.isRemote) {
  			if(cargoItems[0] != null && cargoItems[0].itemID == mod_Metalworks.Fuel.shiftedIndex) {
  				if(vehicleFuel == 0) {
  					worldObj.playSoundAtEntity(this, startSound, 1.0F, 1.0F);
  					startSoundTimer = startSoundLength;
  					idleSoundTimer = startSoundLength;
  					driveSoundTimer = startSoundLength;
  				}
  				vehicleFuel += 1000;
  				decrStackSize(0, 1);
  				worldObj.playSoundAtEntity(this, "refuel", 1.0F, 1.0F);
  			} else {
  				engineSpeed -= 0.01D * decceleration;
  			}
  		}
  		if(vehicleAmmo < maxAmmo && riddenByEntity != null && !worldObj.isRemote) {
  			if(cargoItems[0] != null && cargoItems[0].itemID == mod_HLights.HLight.blockID && hasDrill) {
  				vehicleAmmo++;
  				decrStackSize(0, 1);
  				worldObj.playSoundAtEntity(this, "rearm", 1.0F, 1.0F);
  			}
  			if(cargoItems[0] != null && cargoItems[0].itemID == mod_Rways.Asphalt.shiftedIndex && hasPaver) {
  				vehicleAmmo = vehicleAmmo + 4;
  				decrStackSize(0, 1);
  				worldObj.playSoundAtEntity(this, "rearm", 1.0F, 1.0F);
  			}
  		}
  		if(vehicleHealth < maxHealth && riddenByEntity != null && !worldObj.isRemote && cargoItems[0] != null && cargoItems[0].itemID == mod_HeavyVehicles.SpareParts.shiftedIndex) {
  			vehicleHealth += 200;
  			decrStackSize(0, 1);
  			worldObj.playSoundAtEntity(this, "repair", 1.0F, 1.0F);
  		}
  		if(vehicleFuel > 0 && getSpeed() > 0.02D) {
  			vehicleFuel--;
  			if(driveSoundTimer == 0) {
  				worldObj.playSoundAtEntity(this, driveSound, 1.0F, 1.0F);
  				driveSoundTimer = driveSoundLength;
  			}
  		}
  		if(vehicleFuel > 0 && riddenByEntity != null && idleSoundTimer == 0 && refuelRate == 0) {
  			worldObj.playSoundAtEntity(this, idleSound, 1.0F, 1.0F);
  			idleSoundTimer = idleSoundLength;
  		}
  		if(vehicleFuel <= 0 && riddenByEntity != null && idleSoundTimer > 0) {
  			worldObj.playSoundAtEntity(this, stopSound, 1.0F, 1.0F);
  			idleSoundTimer = 0;
  		}
  		if(riddenByEntity != null && hasTurret) {
  			gunYaw = (riddenByEntity.rotationYaw + 90F) - rotationYaw;
  			gunPitch = riddenByEntity.rotationPitch - rotationPitch;
  			if(gunPitch > 0.0F) {
  				gunPitch = 0.0F;
  			}
  			if(gunPitch < -45F) {
  				gunPitch = -45F;
  			}
  		}
  		if(riddenByEntity != null && /*(riddenByEntity instanceof EntityLiving) &&*/ !(riddenByEntity instanceof EntityPlayer)) {
  			double d = engineSpeed;
  			if(d < 0.0D) {
  				d = 0.0D;
  			}
  			double d5 = riddenByEntity.motionX;
  			double d10 = riddenByEntity.motionY;
  			double d13 = riddenByEntity.motionZ;
  			double d15 = Math.sqrt(d5 * d5 + d10 * d10 + d13 * d13);
  			engineSpeed += d15;
  			double d16 = riddenByEntity.rotationYaw;
  			double d17 = riddenByEntity.rotationPitch;
  			if(d16 - (double)rotationYaw > 1.0D) {
  				rotationYaw += d / 3D;
  			}
  			if(d16 - (double)rotationYaw < 1.0D) {
  				rotationYaw -= d / 3D;
  			}
  			if(d17 - (double)rotationPitch > 1.0D) {
  				rotationPitch += d / 3D;
  			}
  			if(d17 - (double)rotationPitch < 1.0D) {
  				rotationPitch -= d / 3D;
  			}
  		}
  		if(shootDelay > 0) {
  			shootDelay--;
  		}
  		if(shellDelay > 0) {
  			shellDelay--;
  		}
  		paverAngle = Math.max(0.0F, Math.min(80F, !paverOn || !hasPaver ? paverAngle + 1.0F : paverAngle - 1.0F));
  		wheelYaw = Math.max(-60F, Math.min(60F, wheelYaw));
  		wheelYaw *= 0.80000000000000004D;
  		if((getSpeed() * 10D <= (double)wheelYaw || wheelYaw <= 0.0F) && (getSpeed() * 5D <= (double)(-wheelYaw) || wheelYaw >= 0.0F) && getSpeed() > 0.0D && !hasTreads) {
  			theta = (Math.atan2(motionZ, motionX) * 180D) / Math.PI;
  			for(theta = (Math.atan2(motionZ, motionX) * 180D) / Math.PI ; theta <= 0.0D ; theta += 360D) {}
  			for( ; theta > 360D ; theta -= 360D) {}
  			double theta0;
  			for(theta0 = rotationYaw ; theta0 <= 0.0D ; theta0 += 360D) {}
  			for( ; theta0 > 360D ; theta0 -= 360D) {}
  			double diff = Math.abs(theta - theta0);
  			if(diff < 90D || diff > 270D) {
  				rotationYaw += 0.4 * (double)wheelYaw * Math.sqrt(getSpeed() / maxSpeed);
  			} else {
  				rotationYaw -= 0.6 * (double)wheelYaw * Math.sqrt(getSpeed() / maxSpeed);
  			}
  			// if(wheelYaw > 0.0F)
  			// {
  			// motionX += getSpeed() * 0.02D * acceleration *
  			// Math.cos(((rotationYaw + 90F) * 3.141593F) / 180F);
  			// motionZ += getSpeed() * 0.02D * acceleration *
  			// Math.sin(((rotationYaw + 90F) * 3.141593F) / 180F);
  			// } else
  			// {
  			// motionX += getSpeed() * 0.02D * acceleration *
  			// Math.cos(((rotationYaw - 90F) * 3.141593F) / 180F);
  			// motionZ += getSpeed() * 0.02D * acceleration *
  			// Math.sin(((rotationYaw - 90F) * 3.141593F) / 180F);
  			// }
  		}
  		if(hasTreads) {
  			theta = (Math.atan2(motionZ, motionX) * 180D) / 3.1415926535897931D;
  			for(theta = (Math.atan2(motionZ, motionX) * 180D) / 3.1415926535897931D ; theta <= 0.0D ; theta += 360D) {}
  			for( ; theta > 360D ; theta -= 360D) {}
  			double theta0;
  			for(theta0 = rotationYaw ; theta0 <= 0.0D ; theta0 += 360D) {}
  			for( ; theta0 > 360D ; theta0 -= 360D) {}
  			double diff = Math.abs(theta - theta0);
  			if(diff < 90D || diff > 270D || getSpeed() < 0.0050000000000000001D) {
  				rotationYaw += 1.0D * (double)wheelYaw;
  			} else {
  				rotationYaw -= 1.0D * (double)wheelYaw;
  			}
  		}
  		if(getSpeed() > maxSpeed) {
  			speed *= maxSpeed / getSpeed();
  		}
  		if(onGround && riddenByEntity == null) {
  			motionX *= 0.2D;
  			motionY *= 0.2D;
  			motionZ *= 0.2D;
  			rotationPitch *= 0.9;
  			engineSpeed *= 0.9;
  		}
  		if(!onGround) {
  			motionY--;
  		}
  		if(worldObj.isRemote) {
  			if(boatPosRotationIncrements > 0) {
  				double d3 = posX + (boatX - posX) / (double)boatPosRotationIncrements;
  				double d8 = posY + (boatY - posY) / (double)boatPosRotationIncrements;
  				double d11 = posZ + (boatZ - posZ) / (double)boatPosRotationIncrements;
  				double d14;
  				for(d14 = boatYaw - (double)rotationYaw ; d14 < -180D ; d14 += 360D) {}
  				for( ; d14 >= 180D ; d14 -= 360D) {}
  				rotationYaw += d14 / (double)boatPosRotationIncrements;
  				rotationPitch += (boatPitch - (double)rotationPitch) / (double)boatPosRotationIncrements;
  				boatPosRotationIncrements--;
  				setPosition(d3, d8, d11);
  				setRotation(rotationYaw, rotationPitch);
  			} else {
  				double d4 = posX + motionX;
  				double d9 = posY + motionY;
  				double d12 = posZ + motionZ;
  				setPosition(d4, d9, d12);
  				// if(onGround)
  				// {
  				// motionX *= 0.5D;
  				// motionY *= 0.5D;
  				// motionZ *= 0.5D;
  				// }
  				// motionX *= 0.99000000953674316D;
  				// motionY *= 0.94999998807907104D;
  				// motionZ *= 0.99000000953674316D;
  			}
  			return;
  		}
  		stepHeight = !drillOn && !paverOn ? 1.0F : 0.5F;
  		moveEntity(motionX, motionY, motionZ);
  		int j = (int)Math.floor(posX);
  		int k = (int)Math.floor(posY + 0.5D);
  		int l = (int)Math.floor(posZ);
  		byte byte0 = 0;
  		byte byte1 = 0;
  		float f;
  		for(f = rotationYaw ; f <= -45F ; f += 360F) {}
  		for( ; f > 315F ; f -= 360F) {}
  		if(f > -45F && f <= 45F) {
  			byte0 = 1;
  			byte1 = 0;
  		}
  		if(f > 45F && f <= 135F) {
  			byte0 = 0;
  			byte1 = 1;
  		}
  