Ejemplo n.º 1
0
 @Callback(direct = true, limit = CALL_LIMIT)
 public Object[] distanceDown(Context context, Arguments args) {
   camera.reset();
   if (args.count() == 2) {
     camera.setRayDirection(
         entity.getWorldObj(),
         entity.xCoord,
         entity.yCoord,
         entity.zCoord,
         ForgeDirection.DOWN,
         (float) args.checkDouble(0),
         (float) args.checkDouble(1));
   } else {
     camera.setRayDirection(
         entity.getWorldObj(),
         entity.xCoord,
         entity.yCoord,
         entity.zCoord,
         ForgeDirection.DOWN,
         0.0F,
         0.0F);
   }
   return new Object[] {camera.getDistance()};
 }
Ejemplo n.º 2
0
 @Callback(direct = true, limit = CALL_LIMIT)
 public Object[] setRayDirection(Context context, Arguments args) {
   camera.reset();
   float x = args.count() == 2 ? (float) args.checkDouble(0) : 0.0F;
   float y = args.count() == 2 ? (float) args.checkDouble(1) : 0.0F;
   if (args.count() == 2) {
     int l =
         MathHelper.floor_double((double) (robot.player().rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
     l = Direction.directionToFacing[l];
     return new Object[] {
       camera.setRayDirection(
           entity.getWorldObj(),
           entity.xCoord,
           entity.yCoord,
           entity.zCoord,
           ForgeDirection.getOrientation(l),
           (float) args.checkDouble(0),
           (float) args.checkDouble(1))
     };
   }
   return null;
 }