Permalink
Browse files

Add "hardness" and "blastResistance" to material_info()

  • Loading branch information...
PseudoKnight committed Aug 9, 2018
1 parent 12ee67a commit e76a76e87abda43398a2de17816919aab065ce77
@@ -33,4 +33,8 @@
boolean isTransparent();
boolean isInteractable();
float getHardness();
float getBlastResistance();
}
@@ -87,6 +87,16 @@ public boolean isInteractable() {
return m.isInteractable();
}
@Override
public float getHardness() {
return m.getHardness();
}
@Override
public float getBlastResistance() {
return m.getBlastResistance();
}
@Override
public Material getHandle() {
return m;
@@ -26,6 +26,7 @@
import com.laytonsmith.core.compiler.FileOptions;
import com.laytonsmith.core.constructs.CArray;
import com.laytonsmith.core.constructs.CBoolean;
import com.laytonsmith.core.constructs.CDouble;
import com.laytonsmith.core.constructs.CInt;
import com.laytonsmith.core.constructs.CNull;
import com.laytonsmith.core.constructs.CString;
@@ -1078,6 +1079,10 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
return CBoolean.get(mat.isTransparent());
case "isInteractable":
return CBoolean.get(mat.isInteractable());
case "hardness":
return new CDouble(mat.getHardness(), t);
case "blastResistance":
return new CDouble(mat.getBlastResistance(), t);
default:
throw new CREFormatException("Invalid argument for material_info", t);
}
@@ -1095,6 +1100,8 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
ret.set("isSolid", CBoolean.get(mat.isSolid()), t);
ret.set("isTransparent", CBoolean.get(mat.isTransparent()), t);
ret.set("isInteractable", CBoolean.get(mat.isInteractable()), t);
ret.set("hardness", new CDouble(mat.getHardness(), t), t);
ret.set("blastResistance", new CDouble(mat.getBlastResistance(), t), t);
return ret;
}
@@ -1113,7 +1120,7 @@ public String docs() {
return "mixed {material, [trait]} Returns an array of info about the material. If a trait is specified,"
+ " it returns only that trait. Available traits: hasGravity, isBlock, isBurnable, isEdible,"
+ " isFlammable, isOccluding, isRecord, isSolid, isTransparent, isInteractable, maxDurability,"
+ " and maxStacksize.";
+ " hardness, blastResistance, and maxStacksize.";
}
@Override

0 comments on commit e76a76e

Please sign in to comment.