Advertisement
Corosus

Untitled

Jan 14th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1. @Override
  2.     public void clickedRight(EntityPlayer player, int face, float localVecX, float localVecY, float localVecZ) {
  3.        
  4.         if (worldObj.isRemote) return;
  5.        
  6.         //0 bottom, 1 top, 2 -z, 3 +z, 4 -x, 5 +x
  7.         //x z -x -z
  8.        
  9.         //vec values range from 0-1 relative to the world coord alignment
  10.         if (face == 0) {
  11.             //no point
  12.         } else if (face == 1) {
  13.             Vec3 vec = Vec3.createVectorHelper(localVecX-0.5F, 0, localVecZ-0.5F);
  14.             vec.rotateAroundY((float) Math.toRadians((((int)(player.rotationYaw/90)) * 90)-180)); //quantified to 90
  15.             clickedFace(player, face, (float)vec.xCoord+0.5F, (float)vec.zCoord+0.5F);
  16.         } else if (face == 2) { //needs invert
  17.             clickedFace(player, face, 1F-localVecX, localVecY);
  18.         } else if (face == 3) {
  19.             clickedFace(player, face, localVecX, localVecY);
  20.         } else if (face == 4) {
  21.             clickedFace(player, face, localVecZ, localVecY);
  22.         } else if (face == 5) { //needs invert
  23.             clickedFace(player, face, 1F-localVecZ, localVecY);
  24.         }
  25.     }
  26.    
  27.     //expects absolute float values with no rotation adjustments required
  28.     public void clickedFace(EntityPlayer player, int face, float localVecX, float localVecY) {
  29.         /*System.out.println(face + " - " + localVecX + " - " + localVecY + " - " + localVecZ);
  30.        
  31.         if (localVecX < 0.5F) {
  32.             System.out.println("left");
  33.         } else {
  34.             System.out.println("right");
  35.         }*/
  36.        
  37.         if (face == 1) {
  38.             setBuildModeChooseCoord(player);
  39.         } else if (face == 2 || face == 3 || face == 4 || face == 5) {
  40.             if (localVecX < 0.5F) {
  41.                 cycleLeft();
  42.             } else {
  43.                 cycleRight();
  44.             }
  45.             sync();
  46.         }
  47.            
  48.        
  49.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement