use of org.lanternpowered.server.inventory.InventorySnapshot in project LanternServer by LanternPowered.
the class LanternShulkerBox method registerKeys.
@Override
public void registerKeys() {
super.registerKeys();
final ValueCollection c = getValueCollection();
c.register(Keys.DISPLAY_NAME, null);
c.registerProcessor(LanternKeys.INVENTORY_SNAPSHOT).add(builder -> builder.offerHandler(((key, valueContainer, inventorySnapshot) -> {
this.inventory.clear();
inventorySnapshot.offerTo(this.inventory);
return DataTransactionResult.successNoData();
})).failAlwaysRemoveHandler().retrieveHandler((key, valueContainer) -> Optional.of(InventorySnapshot.ofInventory(this.inventory))));
}
Aggregations