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 Details

    • BracketHandlers

      public BracketHandlers()
  • Method Details

    • 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"
    • getMaterial

      @BracketResolver("material") public static net.minecraft.world.level.material.Material getMaterial(String tokens)
      Gets the given Material. Throws an Exception if not found.
      Parameters:
      tokens - What you would write in the BEP call.
      Returns:
      The found Material
      DocParam:
      tokens "earth"
    • 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 name, 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 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: `<recipetype:minecraft:crafting>`

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

      @Deprecated(forRemoval=true) public static net.minecraft.resources.ResourceLocation getResourceLocation(String tokens)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a Resource location based on the tokens. Throws an error if the tokens are not a valid location.
      Parameters:
      tokens - The resource location
      Returns:
      The location
      DocParam:
      tokens "minecraft:dirt"
    • 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"
    • getDamageSource

      @BracketResolver("damagesource") public static net.minecraft.world.damagesource.DamageSource getDamageSource(String tokens)
      Gets a damage source based on type. If the damage source is not pre-registered, it will create a new one with the given name
      Parameters:
      tokens - the damage sources' type
      Returns:
      The found pre-registered damage source or a new one
      DocParam:
      tokens "magic"
    • getCreativeModeTab

      @BracketResolver("creativemodetab") public static net.minecraft.world.item.CreativeModeTab getCreativeModeTab(String tokens)
      Gets an CreativeModeTab by name. Will throw an error if the tab could not be found!
      Parameters:
      tokens - The CreativeModeTab's name.
      Returns:
      The found ItemGroup
      DocParam:
      tokens misc
    • 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"
    • 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"