API Surface (3)
EnchantmentNameParts getInstance()
String generateNewRandomName()
void reseedRandomGenerator(long seed)
Fields & Constants (3)
instance
rand
namePartsArray
Full Source
| 1 | package net.minecraft.util;
|
| 2 |
|
| 3 | import java.util.Random;
|
| 4 |
|
| 5 | public class EnchantmentNameParts
|
| 6 | {
|
| 7 | private static final EnchantmentNameParts instance = new EnchantmentNameParts();
|
| 8 | private Random rand = new Random();
|
| 9 | private String[] namePartsArray = "the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ".split(" ");
|
| 10 |
|
| 11 | public static EnchantmentNameParts getInstance()
|
| 12 | {
|
| 13 | return instance;
|
| 14 | }
|
| 15 |
|
| 16 | /**
|
| 17 | * Randomly generates a new name built up of 3 or 4 randomly selected words.
|
| 18 | */
|
| 19 | public String generateNewRandomName()
|
| 20 | {
|
| 21 | int i = this.rand.nextInt(2) + 3;
|
| 22 | String s = "";
|
| 23 |
|
| 24 | for (int j = 0; j < i; ++j)
|
| 25 | {
|
| 26 | if (j > 0)
|
| 27 | {
|
| 28 | s = s + " ";
|
| 29 | }
|
| 30 |
|
| 31 | s = s + this.namePartsArray[this.rand.nextInt(this.namePartsArray.length)];
|
| 32 | }
|
| 33 |
|
| 34 | return s;
|
| 35 | }
|
| 36 |
|
| 37 | /**
|
| 38 | * Resets the underlying random number generator using a given seed.
|
| 39 | */
|
| 40 | public void reseedRandomGenerator(long seed)
|
| 41 | {
|
| 42 | this.rand.setSeed(seed);
|
| 43 | }
|
| 44 | }
|
| 45 |
|
Deobfuscated MCP 1.8.9 source of EnchantmentNameParts from Marcelektro/MavenMCP-1.8.9 (net/minecraft/util/EnchantmentNameParts.java), stored verbatim.