Advertisement
Corosus

NBT friendly enums

Jun 12th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. package CoroAI.entity;
  2.  
  3. import java.util.EnumSet;
  4. import java.util.HashMap;
  5. import java.util.Map;
  6.  
  7. public enum EnumTeam
  8. {
  9.     PLAYER, KOA, HOSTILES, COMRADE;
  10.    
  11.     private static final Map<Integer, EnumTeam> lookup = new HashMap<Integer, EnumTeam>();
  12.     static { for(EnumTeam e : EnumSet.allOf(EnumTeam.class)) { lookup.put(e.ordinal(), e); } }
  13.     public static EnumTeam get(int intValue) { return lookup.get(intValue); }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement