mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 03:00:29 +01:00
Cache the materials... duh
This commit is contained in:
parent
b8d17f466d
commit
cb0e3ee281
@ -1059,6 +1059,7 @@ public enum Materials {
|
|||||||
String old12Mat;
|
String old12Mat;
|
||||||
int data;
|
int data;
|
||||||
boolean is13Plusonly;
|
boolean is13Plusonly;
|
||||||
|
private Material cachedMaterial;
|
||||||
|
|
||||||
Materials(String old13Mat, String old12Mat, int data) {
|
Materials(String old13Mat, String old12Mat, int data) {
|
||||||
this(old13Mat, old12Mat, data, false);
|
this(old13Mat, old12Mat, data, false);
|
||||||
@ -1236,20 +1237,30 @@ public enum Materials {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Material parseMaterial() {
|
public Material parseMaterial() {
|
||||||
if (this.isSpawner() && this != Materials.SPAWNER)
|
if (this.cachedMaterial != null)
|
||||||
return Materials.SPAWNER.parseMaterial();
|
return this.cachedMaterial;
|
||||||
|
|
||||||
|
if (this.isSpawner() && this != Materials.SPAWNER) {
|
||||||
|
this.cachedMaterial = Materials.SPAWNER.parseMaterial();
|
||||||
|
return this.cachedMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
Material mat = Material.matchMaterial(this.toString());
|
Material mat = Material.matchMaterial(this.toString());
|
||||||
if (mat != null)
|
if (mat != null) {
|
||||||
return mat;
|
this.cachedMaterial = mat;
|
||||||
|
return this.cachedMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
if (old13Mat != null) {
|
if (old13Mat != null) {
|
||||||
mat = Material.matchMaterial(old13Mat);
|
mat = Material.matchMaterial(old13Mat);
|
||||||
if (mat != null)
|
if (mat != null) {
|
||||||
return mat;
|
this.cachedMaterial = mat;
|
||||||
|
return this.cachedMaterial;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Material.matchMaterial(old12Mat);
|
this.cachedMaterial = Material.matchMaterial(old12Mat);
|
||||||
|
return this.cachedMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material getPostMaterial() {
|
public Material getPostMaterial() {
|
||||||
|
Loading…
Reference in New Issue
Block a user