use of org.lanternpowered.server.data.ValueCollection in project LanternServer by LanternPowered.
the class LanternItemStack method registerKeys.
private void registerKeys() {
final ValueCollection c = getValueCollection();
((LanternItemType) this.itemType).getKeysProvider().accept(c);
c.register(Keys.DISPLAY_NAME, null);
c.register(Keys.ITEM_LORE, Collections.emptyList());
c.register(Keys.BREAKABLE_BLOCK_TYPES, new HashSet<>());
c.register(Keys.ITEM_ENCHANTMENTS, Collections.emptyList());
}
use of org.lanternpowered.server.data.ValueCollection in project LanternServer by LanternPowered.
the class LanternFurnace method registerKeys.
@Override
public void registerKeys() {
super.registerKeys();
final ElementListener<Integer> clearProperty = (oldElement, newElement) -> this.inventory.resetCachedProgress();
final ValueCollection c = getValueCollection();
c.register(Keys.MAX_BURN_TIME, 0, 0, Integer.MAX_VALUE).addListener(clearProperty);
c.register(Keys.PASSED_BURN_TIME, 0, 0, Keys.MAX_BURN_TIME).addListener(clearProperty);
c.register(Keys.MAX_COOK_TIME, 0, 0, Integer.MAX_VALUE).addListener(clearProperty);
c.register(Keys.PASSED_COOK_TIME, 0, 0, Keys.MAX_COOK_TIME).addListener(clearProperty);
}
use of org.lanternpowered.server.data.ValueCollection 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