use of uk.co.qmunity.lib.part.compat.fmp.FMPPart in project BluePower by Qmunity.
the class WorldConverter method convertTile.
private boolean convertTile(NBTTagCompound tag) {
NBTTagList parts = tag.getTagList("parts", new NBTTagCompound().getId());
int count = parts.tagCount();
FMPPart fmppart = new FMPPart(true);
for (int i = 0; i < count; i++) {
NBTTagCompound part = parts.getCompoundTagAt(i);
String id = part.getString("id");
for (IPartConverter c : converters) {
if (c.matches(id)) {
IPart p = c.convert(part);
if (p == null)
continue;
fmppart.addPart(p);
parts.removeTag(i);
i--;
break;
}
}
count = parts.tagCount();
}
if (fmppart.getParts().size() > 0) {
NBTTagCompound part = new NBTTagCompound();
fmppart.save(part);
part.setString("id", fmppart.getType());
parts.appendTag(part);
return true;
}
return false;
}
Aggregations