Skip to content

Commit

Permalink
patch block-like dMaterial issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 14, 2019
1 parent b573635 commit 572249f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 5 additions & 6 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dItem.java
Expand Up @@ -465,6 +465,9 @@ public String getScriptName() {
}

public dMaterial getMaterial() {
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_13_R2)) {
return dMaterial.getMaterialFrom(getItemStack().getType());
}
return dMaterial.getMaterialFrom(getItemStack().getType(), getItemStack().getData().getData());
}

Expand Down Expand Up @@ -583,16 +586,12 @@ else if (isItemscript()) {
return "i@" + identifyMaterial().replace("m@", "");
}


// Special-case that essentially fetches the material of the items and uses its 'identify()' method
public String identifyMaterial() {
return dMaterial.getMaterialFrom(item.getType(), item.getData().getData()).identifySimple();
return getMaterial().identifySimple();
}


// Special-case that essentially fetches the material of the items and uses its 'identify()' method
public String identifyMaterialNoIdentifier() {
return dMaterial.getMaterialFrom(item.getType(), item.getData().getData()).identifySimpleNoIdentifier();
return getMaterial().identifySimpleNoIdentifier();
}

public String identifyNoIdentifier() {
Expand Down
Expand Up @@ -599,8 +599,11 @@ public static dMaterial getMaterialFrom(Material material, int data) {
return material_varieties.get(material).get(data);
}
}
if (material.isBlock()) {
material = NMSHandler.getInstance().getBlockHelper().getBlockData(material, (byte) data).getMaterial();
if (data != 0 && NMSHandler.getVersion().isAtLeast(NMSVersion.v1_13_R2)) {
// upvert old data valued materials
if (material.isBlock()) {
material = NMSHandler.getInstance().getBlockHelper().getBlockData(material, (byte) data).getMaterial();
}
}
// Forcible upvert.
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_13_R2)) {
Expand Down

0 comments on commit 572249f

Please sign in to comment.