Search in sources :

Example 1 with DuctDataBuilder

use of org.cubeengine.module.itemduct.data.DuctDataBuilder in project modules-extra by CubeEngine.

the class ItemDuctManager method setup.

public void setup(PluginContainer plugin, ItemductConfig config) {
    if (!this.init) {
        DataRegistration.<DuctData, ImmutableDuctData>builder().dataClass(DuctData.class).immutableClass(ImmutableDuctData.class).builder(new DuctDataBuilder()).manipulatorId("duct").dataName("CubeEngine ItemDuct Data").buildAndRegister(plugin);
        DuctData.FILTERS.getQuery();
        Ingredient hopper = Ingredient.of(ItemTypes.HOPPER);
        activatorItem = ItemStack.of(ItemTypes.HOPPER, 1);
        activatorItem.offer(Keys.ITEM_ENCHANTMENTS, singletonList(Enchantment.builder().type(EnchantmentTypes.LOOTING).level(1).build()));
        activatorItem.offer(Keys.DISPLAY_NAME, Text.of(TextColors.GOLD, "ItemDuct Activator"));
        activatorItem.offer(Keys.HIDE_ENCHANTMENTS, true);
        activatorItem.offer(new DuctData(config.activatorUses));
        activatorItem.offer(Keys.ITEM_LORE, Collections.singletonList(Text.of("Uses: ", config.activatorUses)));
        this.recipe = CraftingRecipe.shapedBuilder().rows().row(hopper, hopper, hopper).row(hopper, Ingredient.of(ItemTypes.DIAMOND), hopper).row(hopper, hopper, hopper).result(activatorItem.copy()).build("ItemDuctActivator", plugin);
        Sponge.getRegistry().getCraftingRecipeRegistry().register(this.recipe);
        activatorItem.offer(new DuctData(config.superActivatorUses));
        activatorItem.offer(Keys.ITEM_LORE, Collections.singletonList(Text.of("Uses: Infinite")));
        activatorItem.offer(Keys.DISPLAY_NAME, Text.of(TextColors.GOLD, "ItemDuct Super Activator"));
        this.superRecipe = CraftingRecipe.shapedBuilder().rows().row(hopper, hopper, hopper).row(hopper, Ingredient.of(ItemTypes.NETHER_STAR), hopper).row(hopper, hopper, hopper).result(activatorItem.copy()).build("ItemDuctSuperActivator", plugin);
        Sponge.getRegistry().getCraftingRecipeRegistry().register(this.superRecipe);
    }
    this.reload(config);
    this.init = true;
}
Also used : Ingredient(org.spongepowered.api.item.recipe.crafting.Ingredient) ImmutableDuctData(org.cubeengine.module.itemduct.data.ImmutableDuctData) IDuctData(org.cubeengine.module.itemduct.data.IDuctData) DuctData(org.cubeengine.module.itemduct.data.DuctData) ImmutableDuctData(org.cubeengine.module.itemduct.data.ImmutableDuctData) DuctDataBuilder(org.cubeengine.module.itemduct.data.DuctDataBuilder)

Aggregations

DuctData (org.cubeengine.module.itemduct.data.DuctData)1 DuctDataBuilder (org.cubeengine.module.itemduct.data.DuctDataBuilder)1 IDuctData (org.cubeengine.module.itemduct.data.IDuctData)1 ImmutableDuctData (org.cubeengine.module.itemduct.data.ImmutableDuctData)1 Ingredient (org.spongepowered.api.item.recipe.crafting.Ingredient)1