Permalink
Browse files

Fix change in item string output.

Previously we were always including a data suffix ":0" for block items, but not for other items. This restores that behavior.
  • Loading branch information...
PseudoKnight committed Jan 2, 2018
1 parent a4ffb5f commit 7033636e5b531e0936acd6036a2ef9ba97cc1b8a
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/main/java/com/laytonsmith/core/Static.java
@@ -10,6 +10,7 @@
import com.laytonsmith.abstraction.MCEntity;
import com.laytonsmith.abstraction.MCItemStack;
import com.laytonsmith.abstraction.MCLivingEntity;
import com.laytonsmith.abstraction.MCMaterialData;
import com.laytonsmith.abstraction.MCMetadatable;
import com.laytonsmith.abstraction.MCOfflinePlayer;
import com.laytonsmith.abstraction.MCPlayer;
@@ -609,7 +610,16 @@ public static String ParseItemNotation(MCItemStack is) {
if (is == null) {
return "0";
}
return is.getTypeId() + (is.getDurability() == 0 ? "" : ":" + Short.toString(is.getDurability()));
String append = null;
if (is.getDurability() != 0) {
append = Short.toString(is.getDurability());
} else {
MCMaterialData md = is.getData();
if (md != null) {
append = Integer.toString(md.getData());
}
}
return is.getTypeId() + (append == null ? "" : ":" + append);
}
public static String ParseItemNotation(MCBlock b) {

1 comment on commit 7033636

@PseudoKnight

This comment has been minimized.

Show comment
Hide comment
@PseudoKnight

PseudoKnight Jan 2, 2018

Contributor

Actually, my description is inaccurate. It was including the suffix for all items. It was just misleading because MCMaterialData handling here is redundant, which was what I was originally trying to remove. I'll fix this redundancy again later.

Contributor

PseudoKnight commented on 7033636 Jan 2, 2018

Actually, my description is inaccurate. It was including the suffix for all items. It was just misleading because MCMaterialData handling here is redundant, which was what I was originally trying to remove. I'll fix this redundancy again later.

Please sign in to comment.