Class BracketHandlers

java.lang.Object
com.blamejared.crafttweaker.api.bracket.BracketHandlers

@ZenRegister public class BracketHandlers extends Object
This class contains the "simple" Bracket handlers from CraftTweaker. However, some Bracket handlers, like for recipeTypes, tags, tagManagers, won't be shown here as they use a different internal structure.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.world.entity.ai.attributes.Attribute
     
    static net.minecraft.world.level.block.entity.BannerPattern
    Gets a banner pattern based on registry name.
    static net.minecraft.world.level.block.Block
    getBlock(String tokens)
    Gets the give Block.
    static net.minecraft.world.level.block.state.BlockState
    Creates a Blockstate based on the given inputs.
    static net.minecraft.world.level.block.state.BlockState
    getBlockState(String name, String properties)
     
    static net.minecraft.world.level.block.state.BlockState
    getBlockState(net.minecraft.world.level.block.Block block, String properties)
     
    static net.minecraft.core.component.DataComponentType
    Gets a data component type based on registry name.
    static net.minecraft.world.level.block.entity.DecoratedPotPattern
    Gets a decorated pot pattern based on registry name.
    static net.minecraft.world.item.enchantment.Enchantment
    Gets the enchantment based on registry name.
    static net.minecraft.world.entity.EntityType<net.minecraft.world.entity.Entity>
    Gets the entityType based on registry name.
    Gets the fluid Stack based on registry name.
    static net.minecraft.world.item.Instrument
    Gets an instrument based on registry name.
    static IItemStack
    getItem(String tokens)
    Gets the item based on registry name.
    static net.minecraft.world.effect.MobEffect
    Gets the mobeffect based on registry name.
    static net.minecraft.world.item.alchemy.Potion
    getPotion(String tokens)
     
    static net.minecraft.world.entity.npc.VillagerProfession
    Gets the villager profession based on registry name.
    static IRecipeManager<?>
    Gets the recipeManager based on registry name.
    static <T> T
    getRegistry(String tokens, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry)
     
    static <T> T
    getRegistry(String tokens, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry, boolean includeTypeNamespace)
     
    static net.minecraft.sounds.SoundEvent
    Gets a sound event based on registry name.
    Gets an ITargetingStrategy based on its name.
    static net.minecraft.world.item.armortrim.TrimMaterial
    Gets a trim material based on registry name.
    static net.minecraft.world.item.armortrim.TrimPattern
    Gets a trim pattern based on registry name.
    static net.minecraft.world.entity.npc.VillagerType
    Gets the villager profession based on registry name.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BracketHandlers

      public BracketHandlers()
  • Method Details

    • getRegistry

      public static <T> T getRegistry(String tokens, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry)
    • getRegistry

      public static <T> T getRegistry(String tokens, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry, boolean includeTypeNamespace)
    • getAttribute

      @BracketResolver("attribute") public static net.minecraft.world.entity.ai.attributes.Attribute getAttribute(String tokens)
    • getBlock

      @BracketResolver("block") public static net.minecraft.world.level.block.Block getBlock(String tokens)
      Gets the give Block. Throws an Exception if not found
      Parameters:
      tokens - What you would write in the BEP call.
      Returns:
      The found Block
      DocParam:
      tokens "minecraft:dirt"
    • getFluidStack

      @BracketResolver("fluid") public static IFluidStack getFluidStack(String tokens)
      Gets the fluid Stack based on registry name. Throws an error if it can't find the fluid.
      Parameters:
      tokens - The Fluid's resource location
      Returns:
      A stack of the liquid with amount == 1mb
      DocParam:
      tokens "minecraft:water"
    • getBlockState

      @BracketResolver("blockstate") public static net.minecraft.world.level.block.state.BlockState getBlockState(String tokens)
      Creates a Blockstate based on the given inputs. Returns `null` if it cannot find the block, ignored invalid variants
      Parameters:
      tokens - The block's resource location and variants
      Returns:
      The found BlockState
      DocParam:
      tokens "minecraft:acacia_planks", tokens "minecraft:furnace:facing=north,lit=false"
    • getBlockState

      public static net.minecraft.world.level.block.state.BlockState getBlockState(String name, String properties)
    • getBlockState

      public static net.minecraft.world.level.block.state.BlockState getBlockState(net.minecraft.world.level.block.Block block, String properties)
    • getMobEffect

      @BracketResolver("mobeffect") public static net.minecraft.world.effect.MobEffect getMobEffect(String tokens)
      Gets the mobeffect based on registry name. Throws an error if it can't find the mobeffect.
      Parameters:
      tokens - The mobeffect's resource location
      Returns:
      The found mobeffect
      DocParam:
      tokens "minecraft:haste"
    • getEnchantment

      @BracketResolver("enchantment") public static net.minecraft.world.item.enchantment.Enchantment getEnchantment(String tokens)
      Gets the enchantment based on registry name. Throws an error if it can't find the enchantment.
      Parameters:
      tokens - The enchantment's registry name
      Returns:
      The found enchantment
      DocParam:
      tokens "minecraft:riptide"
    • getEntityType

      @BracketResolver("entitytype") public static net.minecraft.world.entity.EntityType<net.minecraft.world.entity.Entity> getEntityType(String tokens)
      Gets the entityType based on registry name. Throws an exception if it can't find the entityType.
      Parameters:
      tokens - The entityType's resource location
      Returns:
      The found entityType
      DocParam:
      tokens "minecraft:pig"
    • getItem

      @BracketResolver("item") public static IItemStack getItem(String tokens)
      Gets the item based on registry name. Throws an error if it can't find the item.
      Parameters:
      tokens - The item's resource location
      Returns:
      The found item
      DocParam:
      tokens "minecraft:dirt"
    • getPotion

      @BracketResolver("potion") public static net.minecraft.world.item.alchemy.Potion getPotion(String tokens)
    • getRecipeManager

      public static IRecipeManager<?> getRecipeManager(String tokens)
      Gets the recipeManager based on registry name. Throws an error if it can't find the recipeManager. Throws an exception if the given recipeType is not found.

      This will always return IRecipeManager.
      There is also a BEP for that but that works differently so it can't be automatically added to the docs here. But the BEP looks the same as the other ones: `invalid input: '<'recipetype:minecraft:crafting>`

      Parameters:
      tokens - The recipeManager's resource location
      Returns:
      The found recipeManager
      DocParam:
      tokens "minecraft:crafting"
    • getProfession

      @BracketResolver("profession") public static net.minecraft.world.entity.npc.VillagerProfession getProfession(String tokens)
      Gets the villager profession based on registry name. Throws an exception if it can't find the profession.
      Parameters:
      tokens - The profession's resource location
      Returns:
      The found profession
      DocParam:
      tokens "minecraft:armorer"
    • getSoundEvent

      @BracketResolver("soundevent") public static net.minecraft.sounds.SoundEvent getSoundEvent(String tokens)
      Gets a sound event based on registry name. Throws an exception if it can't find the sound event.
      Parameters:
      tokens - The sound event's resource location
      Returns:
      The found sound event
      DocParam:
      tokens "minecraft:ambient.cave"
    • getTargetingStrategy

      @BracketResolver("targetingstrategy") public static ITargetingStrategy getTargetingStrategy(String tokens)
      Gets an ITargetingStrategy based on its name.

      Throws an exception if the strategy doesn't exist.

      Parameters:
      tokens - The strategy's resource location
      Returns:
      The found targeting strategy
      Since:
      10.0.0
      DocParam:
      tokens "crafttweaker:default"
    • getVillagerType

      @BracketResolver("villagertype") public static net.minecraft.world.entity.npc.VillagerType getVillagerType(String tokens)
      Gets the villager profession based on registry name. Throws an exception if it can't find the profession.
      Parameters:
      tokens - The profession's resource location
      Returns:
      The found profession
      DocParam:
      tokens "minecraft:armorer"
    • getComponentType

      @BracketResolver("componenttype") public static net.minecraft.core.component.DataComponentType getComponentType(String tokens)
      Gets a data component type based on registry name. Throws an exception if it can't find the data component type.
      Parameters:
      tokens - The data component type's resource location
      Returns:
      The found data component type
      DocParam:
      tokens "minecraft:max_stack_size"
    • getBannerPattern

      @BracketResolver("bannerpattern") public static net.minecraft.world.level.block.entity.BannerPattern getBannerPattern(String tokens)
      Gets a banner pattern based on registry name. Throws an exception if it can't find the banner pattern.
      Parameters:
      tokens - The banner pattern's resource location
      Returns:
      The found banner pattern
      DocParam:
      tokens "minecraft:square_bottom_left"
    • getInstrument

      @BracketResolver("instrument") public static net.minecraft.world.item.Instrument getInstrument(String tokens)
      Gets an instrument based on registry name. Throws an exception if it can't find the instrument.
      Parameters:
      tokens - The instrument's resource location
      Returns:
      The found instrument
      DocParam:
      tokens "minecraft:ponder_goat_horn"
    • getTrimPattern

      @BracketResolver("trimpattern") public static net.minecraft.world.item.armortrim.TrimPattern getTrimPattern(String tokens)
      Gets a trim pattern based on registry name. Throws an exception if it can't find the trim pattern.
      Parameters:
      tokens - The trim pattern's resource location
      Returns:
      The found trim pattern
      DocParam:
      tokens "minecraft:sentry"
    • getTrimMaterial

      @BracketResolver("trimmaterial") public static net.minecraft.world.item.armortrim.TrimMaterial getTrimMaterial(String tokens)
      Gets a trim material based on registry name. Throws an exception if it can't find the trim material.
      Parameters:
      tokens - The trim material's resource location
      Returns:
      The found trim material
      DocParam:
      tokens "minecraft:quartz"
    • getDecoratedPotPattern

      @BracketResolver("decoratedpotpattern") public static net.minecraft.world.level.block.entity.DecoratedPotPattern getDecoratedPotPattern(String tokens)
      Gets a decorated pot pattern based on registry name. Throws an exception if it can't find the pattern.
      Parameters:
      tokens - The decorated pot pattern's resource location.
      Returns:
      The found decorated pot pattern.