Advertisement
HalestormXV

Untitled

Feb 4th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.82 KB | None | 0 0
  1. package halestormxv.util.handlers;
  2.  
  3. import net.minecraft.util.IStringSerializable;
  4.  
  5. public class EnumHandlerStone
  6. {
  7.     public static enum EnumTypeStone implements IStringSerializable
  8.     {
  9.         LUPRESIUM_SMOOTHSTONE(0, "lupresium_smoothstone"),
  10.         LUPRESIUM_RUNESTONE(1, "lupresium_runestone"),
  11.         LUPRESIUM_BRICK(2, "lupresium_brick"),
  12.         LUPRESIUM_CHISELED(3, "lupresium_chiseled"),
  13.  
  14.         MYSTIC_SMOOTHSTONE(4, "mystic_smoothstone"),
  15.         MYSTIC_RUNESTONE(5, "mystic_runestone"),
  16.         MYSTIC_BRICK(6, "mystic_brick"),
  17.         MYSTIC_CHISELED(7, "mystic_chiseled");
  18.  
  19.         private static final EnumTypeStone[] META_LOOKUP = new EnumTypeStone[values().length];
  20.         private final int meta;
  21.         private final String name, unlocalizedName;
  22.  
  23.         private EnumTypeStone(int meta, String name)
  24.         {
  25.             this(meta, name, name);
  26.         }
  27.  
  28.         private EnumTypeStone(int meta, String name, String unlocalizedName)
  29.         {
  30.            this.meta = meta;
  31.            this.name = name;
  32.            this.unlocalizedName = unlocalizedName;
  33.         }
  34.  
  35.         @Override
  36.         public String getName()
  37.         {
  38.             return this.name;
  39.         }
  40.  
  41.         public int getMeta()
  42.         {
  43.             return this.meta;
  44.         }
  45.  
  46.         public String getUnlocalizedName()
  47.         {
  48.             return this.unlocalizedName;
  49.         }
  50.  
  51.         @Override
  52.         public String toString()
  53.         {
  54.             return this.name;
  55.         }
  56.  
  57.         public static EnumTypeStone byMetadata(int meta)
  58.         {
  59.             return META_LOOKUP[meta];
  60.         }
  61.  
  62.         static
  63.         {
  64.             for(EnumTypeStone enumTypeStone: values())
  65.             {
  66.                 META_LOOKUP[enumTypeStone.getMeta()] = enumTypeStone;
  67.             }
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement