Weather.java 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Roughly Enough Items by Danielshe.
  3. * Licensed under the MIT License.
  4. */
  5. package me.shedaniel.rei.impl;
  6. import me.shedaniel.rei.api.annotations.Internal;
  7. @Internal
  8. public enum Weather {
  9. CLEAR(0, "text.rei.weather.clear"),
  10. RAIN(1, "text.rei.weather.rain"),
  11. THUNDER(2, "text.rei.weather.thunder");
  12. private final int id;
  13. private final String translateKey;
  14. Weather(int id, String translateKey) {
  15. this.id = id;
  16. this.translateKey = translateKey;
  17. }
  18. public static Weather byId(int id) {
  19. return byId(id, CLEAR);
  20. }
  21. public static Weather byId(int id, Weather defaultWeather) {
  22. for (Weather weather : values()) {
  23. if (weather.id == id)
  24. return weather;
  25. }
  26. return defaultWeather;
  27. }
  28. public int getId() {
  29. return id;
  30. }
  31. public String getTranslateKey() {
  32. return translateKey;
  33. }
  34. }