objects.add(objectInSlot);
}
slot.clear();
removeSlot("content");
final RPSlot newSlot = new ChestSlot(this);
addSlot(newSlot);
// Restore the stored items
ItemTransformer transformer = new ItemTransformer();
for (final RPObject rpobject : objects) {
try {
Item item = transformer.transform(rpobject);
// log removed items
if (item == null) {
int quantity = 1;
if (rpobject.has("quantity")) {
quantity = rpobject.getInt("quantity");
}
logger.warn("Cannot restore " + quantity + " "
+ rpobject.get("name") + " of stored chest "
+ " because this item"
+ " was removed from items.xml");
continue;
}
newSlot.add(item);
} catch (final Exception e) {
logger.error("Error adding " + rpobject + " to stored chest slot", e);
}
}
}