Advertisement
Barteks2x

Untitled

May 14th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1.  
  2.     private enum PopulationState {
  3.         DONE_X0Y0Z0(new Vec3i(0, 0, 0)),
  4.         DONE_X0Y0Z1(new Vec3i(0, 0, 1)),
  5.         DONE_X0Y1Z0(new Vec3i(0, 1, 0)),
  6.         DONE_X0Y1Z1(new Vec3i(0, 1, 1)),
  7.  
  8.         DONE_X1Y0Z0(new Vec3i(1, 0, 0)),
  9.         DONE_X1Y0Z1(new Vec3i(1, 0, 1)),
  10.         DONE_X1Y1Z0(new Vec3i(1, 1, 0)),
  11.         DONE_X1Y1Z1(new Vec3i(1, 1, 1));
  12.  
  13.         private Vec3i vec3i;
  14.  
  15.         PopulationState(Vec3i vec3i) {
  16.             this.vec3i = vec3i;
  17.         }
  18.  
  19.         static PopulationState fromVec(Vec3i v) {
  20.             int ordinal = v.getX() << 2 | v.getY() << 1 | v.getZ();
  21.             return PopulationState.values()[ordinal];
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement