Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1.         if(KeyInputHandler.claxon.isPressed()) {
  2.             player.sendMessage(new TextComponentString("CLAXOOOONNNN"));
  3.  
  4.             return true;
  5.         }else {
  6.  
  7.             switch (key) {
  8.                 case 0: // Accelerate : Increase the throttle, up to 1.
  9.                 {
  10.                     throttle += 0.01F;
  11.                     if (throttle > 1F)
  12.                         throttle = 1F;
  13.  
  14.                     return true;
  15.                 }
  16.                 case 1: // Decelerate : Decrease the throttle, down to -1, or 0 if the vehicle cannot reverse
  17.                 {
  18.                     throttle -= 0.01F;
  19.                     if (throttle < -1F)
  20.                         throttle = -1F;
  21.                     if (throttle < 0F && type.maxNegativeThrottle == 0F)
  22.                         throttle = 0F;
  23.  
  24.                     return true;
  25.                 }
  26.                 case 2: // Left : Yaw the wheels left
  27.                 {
  28.                     wheelsYaw -= 1F;
  29.  
  30.                     return true;
  31.                 }
  32.                 case 3: // Right : Yaw the wheels right
  33.                 {
  34.                     wheelsYaw += 1F;
  35.  
  36.                     return true;
  37.                 }
  38.                 case 4: // Up : Brake
  39.                 {
  40.                     throttle *= 0.8F;
  41.                     if (onGround) {
  42.                         motionX *= 0.8F;
  43.                         motionZ *= 0.8F;
  44.                     }
  45.  
  46.                     return true;
  47.                 }
  48.                 case 7: //Inventory
  49.                 {
  50.                     if (world.isRemote) {
  51.                         FlansMod.proxy.openDriveableMenu((EntityPlayer) getSeat(0).getControllingPassenger(), world, this);
  52.                     }
  53.  
  54.                     return true;
  55.                 }
  56.                 case 14: // Door
  57.                 {
  58.                     if (toggleTimer <= 0) {
  59.                         varDoor = !varDoor;
  60.                         if (type.hasDoor)
  61.                             player.sendMessage(new TextComponentString("Doors " + (varDoor ? "open" : "closed")));
  62.                         toggleTimer = 10;
  63.                         FlansMod.getPacketHandler().sendToServer(new PacketVehicleControl(this));
  64.                     }
  65.  
  66.                     return true;
  67.                 }
  68.                 default: {
  69.                     return super.pressKey(key, player, isOnEvent);
  70.                 }
  71.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement