Search in sources :

Example 1 with MaterialIdNBT

use of slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT in project TinkersConstruct by SlimeKnights.

the class ToolBuildHandler method buildToolForRendering.

/**
 * Builds a tool using the render materials for the sake of display in UIs
 * @param item        Tool item
 * @param definition  Tool definition
 * @return  Tool for rendering
 */
public static ItemStack buildToolForRendering(Item item, ToolDefinition definition) {
    // if no parts, just return the item directly with the display tag
    ItemStack stack = new ItemStack(item);
    if (definition.isMultipart()) {
        // use all 5 render materials for display stacks, having too many materials is not a problem and its easier than making this reload sensitive
        stack = new MaterialIdNBT(RENDER_MATERIALS).updateStack(stack);
    }
    stack.getOrCreateTag().putBoolean(TooltipUtil.KEY_DISPLAY, true);
    return stack;
}
Also used : ItemStack(net.minecraft.world.item.ItemStack) MaterialIdNBT(slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT)

Example 2 with MaterialIdNBT

use of slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT in project TinkersConstruct by SlimeKnights.

the class AdvancementsProvider method generate.

/**
 * Generates the advancements
 */
protected void generate() {
    // tinkering path
    Advancement materialsAndYou = builder(TinkerCommons.materialsAndYou, resource("tools/materials_and_you"), resource("textures/gui/advancement_background.png"), FrameType.TASK, builder -> builder.addCriterion("crafted_book", hasItem(TinkerCommons.materialsAndYou)));
    Advancement partBuilder = builder(TinkerTables.partBuilder, resource("tools/part_builder"), materialsAndYou, FrameType.TASK, builder -> builder.addCriterion("crafted_block", hasItem(TinkerTables.partBuilder)));
    builder(TinkerToolParts.pickHead.get().withMaterialForDisplay(MaterialIds.wood), resource("tools/make_part"), partBuilder, FrameType.TASK, builder -> builder.addCriterion("crafted_part", hasTag(TinkerTags.Items.TOOL_PARTS)));
    Advancement tinkerStation = builder(TinkerTables.tinkerStation, resource("tools/tinker_station"), partBuilder, FrameType.TASK, builder -> builder.addCriterion("crafted_block", hasItem(TinkerTables.tinkerStation)));
    Advancement tinkerTool = builder(TinkerTools.pickaxe.get().getRenderTool(), resource("tools/tinker_tool"), tinkerStation, FrameType.TASK, builder -> builder.addCriterion("crafted_tool", hasTag(TinkerTags.Items.MULTIPART_TOOL)));
    builder(TinkerMaterials.manyullyn.getIngot(), resource("tools/material_master"), tinkerTool, FrameType.CHALLENGE, builder -> {
        Consumer<MaterialId> with = id -> builder.addCriterion(id.getPath(), InventoryChangeTrigger.TriggerInstance.hasItems(ToolPredicate.builder().withMaterial(id).build()));
        // tier 1
        with.accept(MaterialIds.wood);
        with.accept(MaterialIds.flint);
        with.accept(MaterialIds.rock);
        with.accept(MaterialIds.bone);
        with.accept(MaterialIds.necroticBone);
        with.accept(MaterialIds.leather);
        with.accept(MaterialIds.string);
        with.accept(MaterialIds.vine);
        // tier 2
        with.accept(MaterialIds.iron);
        with.accept(MaterialIds.searedStone);
        with.accept(MaterialIds.scorchedStone);
        with.accept(MaterialIds.copper);
        with.accept(MaterialIds.slimewood);
        with.accept(MaterialIds.chain);
        with.accept(MaterialIds.skyslimeVine);
        // tier 3
        with.accept(MaterialIds.roseGold);
        with.accept(MaterialIds.slimesteel);
        with.accept(MaterialIds.nahuatl);
        with.accept(MaterialIds.bronze);
        with.accept(MaterialIds.pigIron);
        with.accept(MaterialIds.cobalt);
        // tier 4
        with.accept(MaterialIds.manyullyn);
        with.accept(MaterialIds.hepatizon);
        with.accept(MaterialIds.queensSlime);
        with.accept(MaterialIds.blazingBone);
        with.accept(MaterialIds.enderslimeVine);
    });
    builder(TinkerTools.travelersGear.get(ArmorSlotType.HELMET).getRenderTool(), resource("tools/travelers_gear"), tinkerStation, FrameType.TASK, builder -> TinkerTools.travelersGear.forEach((type, armor) -> builder.addCriterion("crafted_" + type.getSerializedName(), hasItem(armor))));
    builder(TinkerTools.pickaxe.get().getRenderTool(), resource("tools/tool_smith"), tinkerTool, FrameType.CHALLENGE, builder -> {
        Consumer<Item> with = item -> builder.addCriterion(Objects.requireNonNull(item.getRegistryName()).getPath(), hasItem(item));
        with.accept(TinkerTools.pickaxe.get());
        with.accept(TinkerTools.mattock.get());
        with.accept(TinkerTools.pickadze.get());
        with.accept(TinkerTools.handAxe.get());
        with.accept(TinkerTools.kama.get());
        with.accept(TinkerTools.dagger.get());
        with.accept(TinkerTools.sword.get());
    });
    Advancement modified = builder(Items.REDSTONE, resource("tools/modified"), tinkerTool, FrameType.TASK, builder -> builder.addCriterion("crafted_tool", InventoryChangeTrigger.TriggerInstance.hasItems(ToolPredicate.builder().hasUpgrades(true).build())));
    // builder(TinkerTools.cleaver.get().buildToolForRendering(), location("tools/glass_cannon"), modified, FrameType.CHALLENGE, builder ->
    // builder.addCriterion()("crafted_tool", InventoryChangeTrigger.TriggerInstance.hasItems(ToolPredicate.builder()
    // .withStat(StatPredicate.max(ToolStats.DURABILITY, 100))
    // .withStat(StatPredicate.min(ToolStats.ATTACK_DAMAGE, 20))
    // .build())));
    builder(Items.WRITABLE_BOOK, resource("tools/upgrade_slots"), modified, FrameType.CHALLENGE, builder -> builder.addCriterion("has_modified", InventoryChangeTrigger.TriggerInstance.hasItems(ToolPredicate.builder().upgrades(ModifierMatch.list(5, ModifierMatch.entry(TinkerModifiers.writable.get()), ModifierMatch.entry(TinkerModifiers.recapitated.get()), ModifierMatch.entry(TinkerModifiers.harmonious.get()), ModifierMatch.entry(TinkerModifiers.resurrected.get()), ModifierMatch.entry(TinkerModifiers.gilded.get()))).build())));
    // smeltery path
    Advancement punySmelting = builder(TinkerCommons.punySmelting, resource("smeltery/puny_smelting"), materialsAndYou, FrameType.TASK, builder -> builder.addCriterion("crafted_book", hasItem(TinkerCommons.punySmelting)));
    Advancement melter = builder(TinkerSmeltery.searedMelter, resource("smeltery/melter"), punySmelting, FrameType.TASK, builder -> {
        Consumer<Block> with = block -> builder.addCriterion(Objects.requireNonNull(block.getRegistryName()).getPath(), PlacedBlockTrigger.TriggerInstance.placedBlock(block));
        with.accept(TinkerSmeltery.searedMelter.get());
        with.accept(TinkerSmeltery.searedTable.get());
        with.accept(TinkerSmeltery.searedBasin.get());
        with.accept(TinkerSmeltery.searedFaucet.get());
        with.accept(TinkerSmeltery.searedHeater.get());
        TinkerSmeltery.searedTank.forEach(with);
        // first 4 are required, and then any of the last 5
        builder.requirements(new CountRequirementsStrategy(1, 1, 1, 1, 1 + TankType.values().length));
    });
    builder(TinkerSmeltery.toolHandleCast.getSand(), resource("smeltery/sand_casting"), melter, FrameType.TASK, builder -> builder.addCriterion("crafted_cast", hasTag(TinkerTags.Items.BLANK_SINGLE_USE_CASTS)));
    Advancement goldCasting = builder(TinkerSmeltery.pickHeadCast, resource("smeltery/gold_casting"), melter, FrameType.TASK, builder -> builder.addCriterion("crafted_cast", hasTag(TinkerTags.Items.GOLD_CASTS)));
    builder(TinkerSmeltery.hammerHeadCast, resource("smeltery/cast_collector"), goldCasting, FrameType.GOAL, builder -> {
        Consumer<CastItemObject> with = cast -> builder.addCriterion(cast.getName().getPath(), hasItem(cast.get()));
        with.accept(TinkerSmeltery.ingotCast);
        with.accept(TinkerSmeltery.nuggetCast);
        with.accept(TinkerSmeltery.gemCast);
        with.accept(TinkerSmeltery.rodCast);
        with.accept(TinkerSmeltery.repairKitCast);
        // parts
        with.accept(TinkerSmeltery.pickHeadCast);
        with.accept(TinkerSmeltery.smallAxeHeadCast);
        with.accept(TinkerSmeltery.smallBladeCast);
        with.accept(TinkerSmeltery.hammerHeadCast);
        with.accept(TinkerSmeltery.broadBladeCast);
        with.accept(TinkerSmeltery.broadAxeHeadCast);
        with.accept(TinkerSmeltery.toolBindingCast);
        with.accept(TinkerSmeltery.roundPlateCast);
        with.accept(TinkerSmeltery.largePlateCast);
        with.accept(TinkerSmeltery.toolHandleCast);
        with.accept(TinkerSmeltery.toughHandleCast);
    });
    Advancement mightySmelting = builder(TinkerCommons.mightySmelting, resource("smeltery/mighty_smelting"), melter, FrameType.TASK, builder -> builder.addCriterion("crafted_book", hasItem(TinkerCommons.mightySmelting)));
    Advancement smeltery = builder(TinkerSmeltery.smelteryController, resource("smeltery/structure"), mightySmelting, FrameType.TASK, builder -> builder.addCriterion("open_smeltery", BlockContainerOpenedTrigger.Instance.container(TinkerSmeltery.smeltery.get())));
    Advancement anvil = builder(TinkerTables.tinkersAnvil, resource("smeltery/tinkers_anvil"), smeltery, FrameType.GOAL, builder -> {
        builder.addCriterion("crafted_overworld", hasItem(TinkerTables.tinkersAnvil));
        builder.addCriterion("crafted_nether", hasItem(TinkerTables.scorchedAnvil));
        builder.requirements(RequirementsStrategy.OR);
    });
    builder(TinkerTools.veinHammer.get().getRenderTool(), resource("smeltery/tool_forge"), anvil, FrameType.CHALLENGE, builder -> {
        Consumer<Item> with = item -> builder.addCriterion(Objects.requireNonNull(item.getRegistryName()).getPath(), hasItem(item));
        with.accept(TinkerTools.sledgeHammer.get());
        with.accept(TinkerTools.veinHammer.get());
        with.accept(TinkerTools.excavator.get());
        with.accept(TinkerTools.broadAxe.get());
        with.accept(TinkerTools.scythe.get());
        with.accept(TinkerTools.cleaver.get());
    });
    builder(TinkerModifiers.silkyCloth, resource("smeltery/abilities"), anvil, FrameType.CHALLENGE, builder -> {
        Consumer<Supplier<? extends Modifier>> with = modifier -> builder.addCriterion(modifier.get().getId().getPath(), InventoryChangeTrigger.TriggerInstance.hasItems(ToolPredicate.builder().modifiers(ModifierMatch.entry(modifier.get())).build()));
        // general
        with.accept(TinkerModifiers.gilded);
        with.accept(TinkerModifiers.luck);
        with.accept(TinkerModifiers.reach);
        with.accept(TinkerModifiers.unbreakable);
        // armor
        with.accept(TinkerModifiers.aquaAffinity);
        with.accept(TinkerModifiers.bouncy);
        with.accept(TinkerModifiers.doubleJump);
        with.accept(TinkerModifiers.flamewake);
        with.accept(TinkerModifiers.frostWalker);
        with.accept(TinkerModifiers.looting);
        with.accept(TinkerModifiers.pathMaker);
        with.accept(TinkerModifiers.plowing);
        with.accept(TinkerModifiers.pockets);
        with.accept(TinkerModifiers.shieldStrap);
        with.accept(TinkerModifiers.slurping);
        with.accept(TinkerModifiers.snowdrift);
        with.accept(TinkerModifiers.strength);
        with.accept(TinkerModifiers.toolBelt);
        with.accept(TinkerModifiers.unarmed);
        with.accept(TinkerModifiers.zoom);
        // harvest
        with.accept(TinkerModifiers.autosmelt);
        with.accept(TinkerModifiers.exchanging);
        with.accept(TinkerModifiers.expanded);
        with.accept(TinkerModifiers.silky);
        // interact
        with.accept(TinkerModifiers.bucketing);
        with.accept(TinkerModifiers.firestarter);
        with.accept(TinkerModifiers.glowing);
        with.accept(TinkerModifiers.pathing);
        with.accept(TinkerModifiers.stripping);
        with.accept(TinkerModifiers.tilling);
        // weapon
        with.accept(TinkerModifiers.dualWielding);
        with.accept(TinkerModifiers.melting);
        with.accept(TinkerModifiers.spilling);
    });
    // foundry path
    Advancement fantasticFoundry = builder(TinkerCommons.fantasticFoundry, resource("foundry/fantastic_foundry"), materialsAndYou, FrameType.TASK, builder -> builder.addCriterion("crafted_book", hasItem(TinkerCommons.fantasticFoundry)));
    builder(TinkerCommons.encyclopedia, resource("foundry/encyclopedia"), fantasticFoundry, FrameType.GOAL, builder -> builder.addCriterion("crafted_book", hasItem(TinkerCommons.encyclopedia)));
    Advancement alloyer = builder(TinkerSmeltery.scorchedAlloyer, resource("foundry/alloyer"), fantasticFoundry, FrameType.TASK, builder -> {
        Consumer<Block> with = block -> builder.addCriterion(Objects.requireNonNull(block.getRegistryName()).getPath(), PlacedBlockTrigger.TriggerInstance.placedBlock(block));
        with.accept(TinkerSmeltery.scorchedAlloyer.get());
        with.accept(TinkerSmeltery.scorchedFaucet.get());
        with.accept(TinkerSmeltery.scorchedTable.get());
        with.accept(TinkerSmeltery.scorchedBasin.get());
        for (TankType type : TankType.values()) {
            with.accept(TinkerSmeltery.scorchedTank.get(type));
        }
        builder.requirements(new CountRequirementsStrategy(1, 1, 1, 1, 2, 2));
    });
    Advancement foundry = builder(TinkerSmeltery.foundryController, resource("foundry/structure"), alloyer, FrameType.TASK, builder -> builder.addCriterion("open_foundry", BlockContainerOpenedTrigger.Instance.container(TinkerSmeltery.foundry.get())));
    Advancement blazingBlood = builder(TankItem.setTank(new ItemStack(TinkerSmeltery.scorchedTank.get(TankType.FUEL_GAUGE)), getTankWith(TinkerFluids.blazingBlood.get(), TankType.FUEL_GAUGE.getCapacity())), resource("foundry/blaze"), foundry, FrameType.GOAL, builder -> {
        Consumer<SearedTankBlock> with = block -> {
            CompoundTag nbt = new CompoundTag();
            nbt.put(NBTTags.TANK, getTankWith(TinkerFluids.blazingBlood.get(), block.getCapacity()).writeToNBT(new CompoundTag()));
            builder.addCriterion(Objects.requireNonNull(block.getRegistryName()).getPath(), InventoryChangeTrigger.TriggerInstance.hasItems(ItemPredicate.Builder.item().of(block).hasNbt(nbt).build()));
            builder.requirements(RequirementsStrategy.OR);
        };
        TinkerSmeltery.searedTank.forEach(with);
        TinkerSmeltery.scorchedTank.forEach(with);
    });
    builder(TinkerTools.plateArmor.get(ArmorSlotType.CHESTPLATE).getRenderTool(), resource("foundry/plate_armor"), blazingBlood, FrameType.GOAL, builder -> TinkerTools.plateArmor.forEach((type, armor) -> builder.addCriterion("crafted_" + type.getSerializedName(), hasItem(armor))));
    builder(TankItem.setTank(new ItemStack(TinkerSmeltery.scorchedLantern), getTankWith(TinkerFluids.moltenManyullyn.get(), TinkerSmeltery.scorchedLantern.get().getCapacity())), resource("foundry/manyullyn_lanterns"), foundry, FrameType.CHALLENGE, builder -> {
        Consumer<SearedLanternBlock> with = block -> {
            CompoundTag nbt = new CompoundTag();
            nbt.put(NBTTags.TANK, getTankWith(TinkerFluids.moltenManyullyn.get(), block.getCapacity()).writeToNBT(new CompoundTag()));
            builder.addCriterion(Objects.requireNonNull(block.getRegistryName()).getPath(), InventoryChangeTrigger.TriggerInstance.hasItems(new ItemPredicate(null, Collections.singleton(block.asItem()), MinMaxBounds.Ints.atLeast(64), MinMaxBounds.Ints.ANY, EnchantmentPredicate.NONE, EnchantmentPredicate.NONE, null, new NbtPredicate(nbt))));
            builder.requirements(RequirementsStrategy.OR);
        };
        with.accept(TinkerSmeltery.searedLantern.get());
        with.accept(TinkerSmeltery.scorchedLantern.get());
    });
    // exploration path
    Advancement tinkersGadgetry = builder(TinkerCommons.tinkersGadgetry, resource("world/tinkers_gadgetry"), materialsAndYou, FrameType.TASK, builder -> builder.addCriterion("crafted_book", hasItem(TinkerCommons.tinkersGadgetry)));
    builder(TinkerWorld.slimeSapling.get(SlimeType.EARTH), resource("world/earth_island"), tinkersGadgetry, FrameType.GOAL, builder -> builder.addCriterion("found_island", LocationTrigger.TriggerInstance.located(LocationPredicate.inFeature(TinkerStructures.earthSlimeIsland.get()))));
    builder(TinkerWorld.slimeSapling.get(SlimeType.SKY), resource("world/sky_island"), tinkersGadgetry, FrameType.GOAL, builder -> builder.addCriterion("found_island", LocationTrigger.TriggerInstance.located(LocationPredicate.inFeature(TinkerStructures.skySlimeIsland.get()))));
    builder(TinkerWorld.slimeSapling.get(SlimeType.BLOOD), resource("world/blood_island"), tinkersGadgetry, FrameType.GOAL, builder -> builder.addCriterion("found_island", LocationTrigger.TriggerInstance.located(LocationPredicate.inFeature(TinkerStructures.bloodIsland.get()))));
    Advancement enderslimeIsland = builder(TinkerWorld.slimeSapling.get(SlimeType.ENDER), resource("world/ender_island"), tinkersGadgetry, FrameType.GOAL, builder -> builder.addCriterion("found_island", LocationTrigger.TriggerInstance.located(LocationPredicate.inFeature(TinkerStructures.endSlimeIsland.get()))));
    builder(Items.CLAY_BALL, resource("world/clay_island"), tinkersGadgetry, FrameType.GOAL, builder -> builder.addCriterion("found_island", LocationTrigger.TriggerInstance.located(LocationPredicate.inFeature(TinkerStructures.clayIsland.get()))));
    Advancement slimes = builder(TinkerCommons.slimeball.get(SlimeType.ICHOR), resource("world/slime_collector"), tinkersGadgetry, FrameType.TASK, builder -> {
        for (SlimeType type : SlimeType.values()) {
            builder.addCriterion(type.getSerializedName(), hasTag(type.getSlimeballTag()));
        }
        builder.addCriterion("magma_cream", hasItem(Items.MAGMA_CREAM));
    });
    builder(TinkerGadgets.slimeSling.get(SlimeType.ENDER), resource("world/slime_sling"), slimes, FrameType.CHALLENGE, builder -> {
        JsonObject boundJSON = new JsonObject();
        boundJSON.addProperty("max", 150);
        MinMaxBounds.Ints mojangDeletedTheMaxMethods = MinMaxBounds.Ints.fromJson(boundJSON);
        TinkerGadgets.slimeSling.forEach((type, sling) -> builder.addCriterion(type.getSerializedName(), ItemDurabilityTrigger.TriggerInstance.changedDurability(EntityPredicate.Composite.ANY, ItemPredicate.Builder.item().of(sling).build(), mojangDeletedTheMaxMethods)));
    });
    builder(TinkerGadgets.piggyBackpack, resource("world/piggybackpack"), tinkersGadgetry, FrameType.GOAL, builder -> builder.addCriterion("used_pack", PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity(EntityPredicate.Composite.ANY, ItemPredicate.Builder.item().of(TinkerGadgets.piggyBackpack), EntityPredicate.Composite.wrap(EntityPredicate.Builder.entity().of(EntityType.PIG).build()))));
    Advancement slimesuit = builder(TinkerTools.slimesuit.get(ArmorSlotType.CHESTPLATE).getRenderTool(), resource("world/slimesuit"), enderslimeIsland, FrameType.GOAL, builder -> TinkerTools.slimesuit.forEach((type, armor) -> builder.addCriterion("crafted_" + type.getSerializedName(), hasItem(armor))));
    builder(new MaterialIdNBT(Collections.singletonList(MaterialIds.gunpowder)).updateStack(new ItemStack(TinkerTools.slimesuit.get(ArmorSlotType.HELMET))), resource("world/slimeskull"), slimesuit, FrameType.CHALLENGE, builder -> {
        Item helmet = TinkerTools.slimesuit.get(ArmorSlotType.HELMET);
        Consumer<MaterialId> with = mat -> builder.addCriterion(mat.getPath(), InventoryChangeTrigger.TriggerInstance.hasItems(ToolPredicate.builder(helmet).withMaterial(mat).build()));
        with.accept(MaterialIds.gunpowder);
        with.accept(MaterialIds.bone);
        with.accept(MaterialIds.necroticBone);
        with.accept(MaterialIds.rottenFlesh);
        with.accept(MaterialIds.enderPearl);
        with.accept(MaterialIds.bloodbone);
        with.accept(MaterialIds.spider);
        with.accept(MaterialIds.venom);
        with.accept(MaterialIds.iron);
        with.accept(MaterialIds.copper);
        with.accept(MaterialIds.blazingBone);
        with.accept(MaterialIds.gold);
        with.accept(MaterialIds.roseGold);
        with.accept(MaterialIds.pigIron);
    });
    // internal advancements
    hiddenBuilder(resource("internal/starting_book"), ConfigEnabledCondition.SPAWN_WITH_BOOK, builder -> {
        builder.addCriterion("tick", new TickTrigger.TriggerInstance(EntityPredicate.Composite.ANY));
        builder.rewards(AdvancementRewards.Builder.loot(TConstruct.getResource("gameplay/starting_book")));
    });
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) JsonObject(com.google.gson.JsonObject) InventoryChangeTrigger(net.minecraft.advancements.critereon.InventoryChangeTrigger) Items(net.minecraft.world.item.Items) ItemDurabilityTrigger(net.minecraft.advancements.critereon.ItemDurabilityTrigger) Item(net.minecraft.world.item.Item) ICondition(net.minecraftforge.common.crafting.conditions.ICondition) FluidTank(net.minecraftforge.fluids.capability.templates.FluidTank) MaterialIds(slimeknights.tconstruct.tools.data.material.MaterialIds) TinkerWorld(slimeknights.tconstruct.world.TinkerWorld) CastItemObject(slimeknights.tconstruct.common.registration.CastItemObject) ArmorSlotType(slimeknights.tconstruct.tools.item.ArmorSlotType) PlacedBlockTrigger(net.minecraft.advancements.critereon.PlacedBlockTrigger) TinkerGadgets(slimeknights.tconstruct.gadgets.TinkerGadgets) ItemPredicate(net.minecraft.advancements.critereon.ItemPredicate) TranslatableComponent(net.minecraft.network.chat.TranslatableComponent) TankType(slimeknights.tconstruct.smeltery.block.component.SearedTankBlock.TankType) RequirementsStrategy(net.minecraft.advancements.RequirementsStrategy) TinkerTables(slimeknights.tconstruct.tables.TinkerTables) SlimeType(slimeknights.tconstruct.shared.block.SlimeType) TinkerTags(slimeknights.tconstruct.common.TinkerTags) ModifierMatch(slimeknights.tconstruct.library.recipe.modifiers.ModifierMatch) EntityPredicate(net.minecraft.advancements.critereon.EntityPredicate) Set(java.util.Set) TinkerTools(slimeknights.tconstruct.tools.TinkerTools) BlockContainerOpenedTrigger(slimeknights.tconstruct.shared.inventory.BlockContainerOpenedTrigger) Sets(com.google.common.collect.Sets) ConfigEnabledCondition(slimeknights.tconstruct.common.json.ConfigEnabledCondition) Objects(java.util.Objects) EnchantmentPredicate(net.minecraft.advancements.critereon.EnchantmentPredicate) CompoundTag(net.minecraft.nbt.CompoundTag) CriterionTriggerInstance(net.minecraft.advancements.CriterionTriggerInstance) TinkerStructures(slimeknights.tconstruct.world.TinkerStructures) Modifier(slimeknights.tconstruct.library.modifiers.Modifier) MinMaxBounds(net.minecraft.advancements.critereon.MinMaxBounds) FluidStack(net.minecraftforge.fluids.FluidStack) ItemStack(net.minecraft.world.item.ItemStack) MaterialIdNBT(slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT) ConditionalAdvancement(net.minecraftforge.common.crafting.ConditionalAdvancement) EntityType(net.minecraft.world.entity.EntityType) FluidAction(net.minecraftforge.fluids.capability.IFluidHandler.FluidAction) TinkerModifiers(slimeknights.tconstruct.tools.TinkerModifiers) TankItem(slimeknights.tconstruct.smeltery.item.TankItem) Supplier(java.util.function.Supplier) FrameType(net.minecraft.advancements.FrameType) LocationTrigger(net.minecraft.advancements.critereon.LocationTrigger) SearedLanternBlock(slimeknights.tconstruct.smeltery.block.SearedLanternBlock) PlayerInteractTrigger(net.minecraft.advancements.critereon.PlayerInteractTrigger) ItemLike(net.minecraft.world.level.ItemLike) TinkerToolParts(slimeknights.tconstruct.tools.TinkerToolParts) GenericDataProvider(slimeknights.mantle.data.GenericDataProvider) BiConsumer(java.util.function.BiConsumer) Fluid(net.minecraft.world.level.material.Fluid) TinkerMaterials(slimeknights.tconstruct.shared.TinkerMaterials) DataGenerator(net.minecraft.data.DataGenerator) TinkerCommons(slimeknights.tconstruct.shared.TinkerCommons) Nullable(javax.annotation.Nullable) AdvancementRewards(net.minecraft.advancements.AdvancementRewards) TinkerFluids(slimeknights.tconstruct.fluids.TinkerFluids) NbtPredicate(net.minecraft.advancements.critereon.NbtPredicate) TickTrigger(net.minecraft.advancements.critereon.TickTrigger) NBTTags(slimeknights.tconstruct.library.utils.NBTTags) HashCache(net.minecraft.data.HashCache) Advancement(net.minecraft.advancements.Advancement) Tag(net.minecraft.tags.Tag) TConstruct(slimeknights.tconstruct.TConstruct) Consumer(java.util.function.Consumer) TinkerSmeltery(slimeknights.tconstruct.smeltery.TinkerSmeltery) MaterialId(slimeknights.tconstruct.library.materials.definition.MaterialId) LocationPredicate(net.minecraft.advancements.critereon.LocationPredicate) Block(net.minecraft.world.level.block.Block) SearedTankBlock(slimeknights.tconstruct.smeltery.block.component.SearedTankBlock) ToolPredicate(slimeknights.tconstruct.library.tools.ToolPredicate) Collections(java.util.Collections) TankType(slimeknights.tconstruct.smeltery.block.component.SearedTankBlock.TankType) JsonObject(com.google.gson.JsonObject) SearedTankBlock(slimeknights.tconstruct.smeltery.block.component.SearedTankBlock) Item(net.minecraft.world.item.Item) TankItem(slimeknights.tconstruct.smeltery.item.TankItem) SlimeType(slimeknights.tconstruct.shared.block.SlimeType) Supplier(java.util.function.Supplier) Modifier(slimeknights.tconstruct.library.modifiers.Modifier) CompoundTag(net.minecraft.nbt.CompoundTag) SearedLanternBlock(slimeknights.tconstruct.smeltery.block.SearedLanternBlock) MaterialId(slimeknights.tconstruct.library.materials.definition.MaterialId) CastItemObject(slimeknights.tconstruct.common.registration.CastItemObject) ItemPredicate(net.minecraft.advancements.critereon.ItemPredicate) TickTrigger(net.minecraft.advancements.critereon.TickTrigger) MinMaxBounds(net.minecraft.advancements.critereon.MinMaxBounds) SearedLanternBlock(slimeknights.tconstruct.smeltery.block.SearedLanternBlock) Block(net.minecraft.world.level.block.Block) SearedTankBlock(slimeknights.tconstruct.smeltery.block.component.SearedTankBlock) NbtPredicate(net.minecraft.advancements.critereon.NbtPredicate) ItemStack(net.minecraft.world.item.ItemStack) MaterialIdNBT(slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT) ConditionalAdvancement(net.minecraftforge.common.crafting.ConditionalAdvancement) Advancement(net.minecraft.advancements.Advancement)

Example 3 with MaterialIdNBT

use of slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT in project TinkersConstruct by SlimeKnights.

the class ToolsRecipeProvider method slimeskullCasting.

/**
 * Helper to create a casting recipe for a slimeskull variant
 */
private void slimeskullCasting(Consumer<FinishedRecipe> consumer, MaterialId material, ItemLike skull, String folder) {
    MaterialIdNBT nbt = new MaterialIdNBT(Collections.singletonList(material));
    ItemCastingRecipeBuilder.basinRecipe(ItemOutput.fromStack(nbt.updateStack(new ItemStack(TinkerTools.slimesuit.get(ArmorSlotType.HELMET))))).setCast(skull, true).setFluidAndTime(TinkerFluids.enderSlime, FluidValues.SLIME_CONGEALED * 5).save(consumer, modResource(folder + "slime_skull/" + material.getPath()));
}
Also used : ItemStack(net.minecraft.world.item.ItemStack) MaterialIdNBT(slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT)

Aggregations

ItemStack (net.minecraft.world.item.ItemStack)3 MaterialIdNBT (slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT)3 Sets (com.google.common.collect.Sets)1 JsonObject (com.google.gson.JsonObject)1 Collections (java.util.Collections)1 Objects (java.util.Objects)1 Set (java.util.Set)1 BiConsumer (java.util.function.BiConsumer)1 Consumer (java.util.function.Consumer)1 Supplier (java.util.function.Supplier)1 Nullable (javax.annotation.Nullable)1 Advancement (net.minecraft.advancements.Advancement)1 AdvancementRewards (net.minecraft.advancements.AdvancementRewards)1 CriterionTriggerInstance (net.minecraft.advancements.CriterionTriggerInstance)1 FrameType (net.minecraft.advancements.FrameType)1 RequirementsStrategy (net.minecraft.advancements.RequirementsStrategy)1 EnchantmentPredicate (net.minecraft.advancements.critereon.EnchantmentPredicate)1 EntityPredicate (net.minecraft.advancements.critereon.EntityPredicate)1 InventoryChangeTrigger (net.minecraft.advancements.critereon.InventoryChangeTrigger)1 ItemDurabilityTrigger (net.minecraft.advancements.critereon.ItemDurabilityTrigger)1