- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleUntitled Paste
TypeDenizen Script
Date2018/06/25 01:17:36 UTC-07:00
ByBloodEko
Other
Paste
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
4000
    @Fetchable("m")
    public static dMaterial valueOf(String string, TagContext context) {

        string = string.toUpperCase();
        if (string.startsWith("M@")) {
            string = string.substring("M@".length());
        }
        if (string.equals("RANDOM")) {
            return getMaterialFrom(Material.values()[CoreUtilities.getRandom().nextInt(Material.values().length)]);
        }
        int index = string.indexOf(',');
        if (index < 0) {
            index = string.indexOf(':');
        }
        int data = 0;
        if (index >= 0) {
            data = aH.getIntegerFrom(string.substring(index + 1));
            string = string.substring(0, index);
        }
        Material m = Material.getMaterial(string);
        if (m != null) {
            return getMaterialFrom(m, data);
        }
        dMaterial mat = all_dMaterials.get(string);
        if (mat != null) {
            if (data == 0) {
                return mat;
            }
            return getMaterialFrom(mat.material, data);
        }
        int matid = aH.getIntegerFrom(string);
        if (matid != 0) {
            m = Material.getMaterial(matid);
            if (m != null) {
                return getMaterialFrom(m, data);
            }
        }
        return null;
    }



RawRaw



Pastes made: 65491