Don't attempt to update empty or invalid flower pots.

This commit is contained in:
wizjany 2019-05-25 00:35:12 -04:00
parent 4804fe64e3
commit 4b15439e03

View File

@ -41,6 +41,9 @@ public class FlowerPotCompatibilityHandler implements NBTCompatibilityHandler {
Tag item = values.get("Item"); Tag item = values.get("Item");
if (item instanceof StringTag) { if (item instanceof StringTag) {
String id = ((StringTag) item).getValue(); String id = ((StringTag) item).getValue();
if (id.isEmpty()) {
return (B) BlockTypes.FLOWER_POT.getDefaultState();
}
int data = 0; int data = 0;
Tag dataTag = values.get("Data"); Tag dataTag = values.get("Data");
if (dataTag instanceof IntTag) { if (dataTag instanceof IntTag) {
@ -75,7 +78,7 @@ public class FlowerPotCompatibilityHandler implements NBTCompatibilityHandler {
break; break;
} }
String plantedName = null; String plantedName = null;
if (newId == 0) { if (newId == 0 && id.startsWith("minecraft:")) {
plantedName = id.substring(10); plantedName = id.substring(10);
} else { } else {
BlockState plantedWithData = LegacyMapper.getInstance().getBlockFromLegacy(newId, data); BlockState plantedWithData = LegacyMapper.getInstance().getBlockFromLegacy(newId, data);