ComponentAccess
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
import crafttweaker.api.component.ComponentAccess;
Description
An interface exposing methods to handle setting and removing DataComponents.DataComponents are the new way of storing data in memory, instead of writing it to NBT data and to disk every time, which has a performance cost. DataComponents now occupy the space that was previously occupied or known as a NBT tag.
DataComponents are immutable. Operations that set or remove a component return a new instance of the object implementing ComponentAccess
DataComponents may optionally be persistent. They also may optionally be syncronised.
In most cases, ComponentAccesses are going to be ItemStacks, although in NeoForge FluidStacks are too.
Members
myComponentAccess.attributeModifiers
Return Type:
ItemAttributeModifiers
myComponentAccess.bannerPatterns
Return Type:
BannerPatternLayers
myComponentAccess.baseColor
Return Type:
DyeColor
myComponentAccess.bees
Return Type:
List<BeehiveBlockEntityOccupant>
myComponentAccess.blockEntityData
Return Type:
CustomData
myComponentAccess.blockState
Return Type:
BlockItemStateProperties
myComponentAccess.bucketEntityData
Return Type:
CustomData
myComponentAccess.bundleContents
Return Type:
BundleContents
myComponentAccess.canBreak
Return Type:
AdventureModePredicate
myComponentAccess.canPlaceOn
Return Type:
AdventureModePredicate
myComponentAccess.chargedProjectiles
Return Type:
ChargedProjectiles
myComponentAccess.container
Return Type:
ItemContainerContents
myComponentAccess.containerLoot
Return Type:
SeededContainerLoot
myComponentAccess.creativeSlotLock
Return Type:
bool
myComponentAccess.customData
Return Type:
CustomData
myComponentAccess.customModelData
Return Type:
CustomModelData
A custom name is generally displayed in italics and controlled by the user.
myComponentAccess.customName
Return Type:
Component
myComponentAccess.damage
Return Type:
int
myComponentAccess.debugStickState
Return Type:
DebugStickState
myComponentAccess.dyedColor
Return Type:
DyedItemColor
If it is present, it is first checked to determine whether there is special behaviour, otherwise the code checks for enchantments.
myComponentAccess.enchantmentGlintOverride
Return Type:
bool
myComponentAccess.enchantments
Return Type:
ItemEnchantments
myComponentAccess.entityData
Return Type:
CustomData
myComponentAccess.fireworkExplosion
Return Type:
FireworkExplosion
myComponentAccess.fireworks
Return Type:
Fireworks
myComponentAccess.food
Return Type:
FoodProperties
myComponentAccess.hasAttributeModifiers
Return Type:
bool
myComponentAccess.hasBannerPatterns
Return Type:
bool
Used for shield colouring.
myComponentAccess.hasBaseColor
Return Type:
bool
myComponentAccess.hasBees
Return Type:
bool
myComponentAccess.hasBlockEntityData
Return Type:
bool
myComponentAccess.hasBlockState
Return Type:
bool
myComponentAccess.hasBucketEntityData
Return Type:
bool
myComponentAccess.hasBundleContents
Return Type:
bool
myComponentAccess.hasCanBreak
Return Type:
bool
myComponentAccess.hasCanPlaceOn
Return Type:
bool
This component is used for crossbows.
myComponentAccess.hasChargedProjectiles
Return Type:
bool
myComponentAccess.hasContainer
Return Type:
bool
myComponentAccess.hasContainerLoot
Return Type:
bool
myComponentAccess.hasCustomData
Return Type:
bool
myComponentAccess.hasCustomModelData
Return Type:
bool
myComponentAccess.hasCustomName
Return Type:
bool
myComponentAccess.hasDamage
Return Type:
bool
myComponentAccess.hasDebugStickState
Return Type:
bool
myComponentAccess.hasDyedColor
Return Type:
bool
myComponentAccess.hasEnchantmentGlintOverride
Return Type:
bool
myComponentAccess.hasEnchantments
Return Type:
bool
myComponentAccess.hasEntityData
Return Type:
bool
myComponentAccess.hasFireworkExplosion
Return Type:
bool
myComponentAccess.hasFireworks
Return Type:
bool
myComponentAccess.hasFood
Return Type:
bool
myComponentAccess.hasInstrument
Return Type:
bool
myComponentAccess.hasItemName
Return Type:
bool
myComponentAccess.hasLock
Return Type:
bool
myComponentAccess.hasLodestoneTracker
Return Type:
bool
myComponentAccess.hasLore
Return Type:
bool
myComponentAccess.hasMapColor
Return Type:
bool
MapDecorations are additional elements that render on a map, such as waypoints.
myComponentAccess.hasMapDecorations
Return Type:
bool
myComponentAccess.hasMapId
Return Type:
bool
This componenet stores additional info on the map, such as the scale or whether to lock it.
myComponentAccess.hasMapPostProcessing
Return Type:
bool
myComponentAccess.hasMaxDamage
Return Type:
bool
myComponentAccess.hasMaxStackSize
Return Type:
bool
myComponentAccess.hasNoteBlockSound
Return Type:
bool
myComponentAccess.hasOminousBottleAmplifier
Return Type:
bool
myComponentAccess.hasPotDecorations
Return Type:
bool
Stores Potion Data on an item.
myComponentAccess.hasPotionContents
Return Type:
bool
myComponentAccess.hasProfile
Return Type:
bool
myComponentAccess.hasRarity
Return Type:
bool
Used for Knowledge Books.
myComponentAccess.hasRecipes
Return Type:
bool
myComponentAccess.hasRepairCost
Return Type:
bool
The stored enchantments component is only present in enchanted books, since it just stores the enchantments under a lid for future use. The item is not enchanted.
myComponentAccess.hasStoredEnchantments
Return Type:
bool
myComponentAccess.hasSuspiciousStewEffects
Return Type:
bool
myComponentAccess.hasTool
Return Type:
bool
myComponentAccess.hasTrim
Return Type:
bool
myComponentAccess.hasUnbreakable
Return Type:
bool
myComponentAccess.hasWritableBookContent
Return Type:
bool
myComponentAccess.hasWrittenBookContent
Return Type:
bool
myComponentAccess.hideAdditionalTooltip
Return Type:
bool
myComponentAccess.hideTooltip
Return Type:
bool
myComponentAccess.instrument
Return Type:
Instrument
myComponentAccess.isFireResistant
Return Type:
bool
myComponentAccess.isIntangibleProjectile
Return Type:
bool
In the case of items, an item name is set by the make to make a special instance of an item, such as with ominous banners.
myComponentAccess.itemName
Return Type:
Component
myComponentAccess.lockComponent
Return Type:
LockCode
myComponentAccess.lodestoneTracker
Return Type:
LodestoneTracker
myComponentAccess.lore
Return Type:
ItemLore
myComponentAccess.mapColor
Return Type:
MapItemColor
myComponentAccess.mapDecorations
Return Type:
MapDecorations
myComponentAccess.mapId
Return Type:
MapId
myComponentAccess.mapPostProcessing
Return Type:
MapPostProcessing
myComponentAccess.maxDamage
Return Type:
int
myComponentAccess.maxStackSize
Return Type:
int
myComponentAccess.noteBlockSound
Return Type:
ResourceLocation
myComponentAccess.ominousBottleAmplifier
Return Type:
int
myComponentAccess.potDecorations
Return Type:
PotDecorations
myComponentAccess.potionContents
Return Type:
PotionContents
myComponentAccess.profile
Return Type:
ResolvableProfile
myComponentAccess.rarity
Return Type:
Rarity
myComponentAccess.recipes
Return Type:
List<ResourceLocation>
myComponentAccess.repairCost
Return Type:
int
myComponentAccess.storedEnchantments
Return Type:
ItemEnchantments
myComponentAccess.suspiciousStewEffects
Return Type:
SuspiciousStewEffects
myComponentAccess.tool
Return Type:
Tool
myComponentAccess.trim
Return Type:
ArmorTrim
myComponentAccess.unbreakable
Return Type:
Unbreakable
ItemAttributeModifiers
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withAttributeModifiers(modifiers as ItemAttributeModifiers) as ComponentAccess;myComponentAccess.withAttributeModifiers(ItemAttributeModifiers.builder().add(<attribute:minecraft:player.block_break_speed>,AttributeModifier.create("test", 2.0, <constant:minecraft:attribute/operation:add_value>, "596e0826-7c66-42c6-b3da-45a6d667ccf7"),<constant:minecraft:equipmentslot/group:mainhand>).build(););
Parameters:
modifiers: ItemAttributeModifiers
Type: ItemAttributeModifiers
- The attributes to give to the item.
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withAttributeModifiers(modifier as ItemAttributeModifiersEntry, showInTooltip as bool = true) as ComponentAccess;myComponentAccess.withAttributeModifiers(myEntry, myBool);
Parameters:
modifier: ItemAttributeModifiersEntry
Type: ItemAttributeModifiersEntry
showInTooltip: bool
(optional) Type: bool
Default Value: true
Return Type:
ComponentAccess
// ComponentAccess<T : ComponentAccess>.withAttributeModifiers(modifiers as List<ItemAttributeModifiersEntry>, showInTooltip as bool = true) as ComponentAccess;myComponentAccess.withAttributeModifiers(myList, myBool);
Parameters:
modifiers: List<ItemAttributeModifiersEntry>
Type: List<ItemAttributeModifiersEntry>
showInTooltip: bool
(optional) Type: bool
Default Value: true
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withBannerPatterns(layers as List<BannerPatternLayersLayer>) as ComponentAccess;myComponentAccess.withBannerPatterns(myList);
Parameters:
layers: List<BannerPatternLayersLayer>
Type: List<BannerPatternLayersLayer>
Return Type:
ComponentAccess
BannerPatternLayers
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withBannerPatterns(layers as BannerPatternLayers) as ComponentAccess;myComponentAccess.withBannerPatterns(myBannerPatternLayers);
Parameters:
layers: BannerPatternLayers
Type: BannerPatternLayers
Return Type:
ComponentAccess
DyeColor
Returns: The new instance with the modified data.
myComponentAccess.withBaseColor(myDyeColor);
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withBees(occupants as List<BeehiveBlockEntityOccupant>) as ComponentAccess;myComponentAccess.withBees(myList);
Parameters:
occupants: List<BeehiveBlockEntityOccupant>
Type: List<BeehiveBlockEntityOccupant>
Return Type:
ComponentAccess
MapData
Returns: The new instance with the modified data.
myComponentAccess.withBlockEntityData(myMapData);
Return Type:
ComponentAccess
CustomData
Returns: The new instance with the modified data.
myComponentAccess.withBlockEntityData(myCustomData);
Parameters:
data: CustomData
Type: CustomData
Return Type:
ComponentAccess
BlockItemStateProperties
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withBlockState(properties as BlockItemStateProperties) as ComponentAccess;myComponentAccess.withBlockState(myBlockItemStateProperties);
Parameters:
properties: BlockItemStateProperties
Type: BlockItemStateProperties
Return Type:
ComponentAccess
MapData
Returns: The new instance with the modified data.
myComponentAccess.withBucketEntityData(myMapData);
Return Type:
ComponentAccess
CustomData
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withBucketEntityData(data as CustomData) as ComponentAccess;myComponentAccess.withBucketEntityData(myCustomData);
Parameters:
data: CustomData
Type: CustomData
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withBundleContents(contents as List<IItemStack>) as ComponentAccess;myComponentAccess.withBundleContents([<item:minecraft:diamond> * 64]);
Parameters:
Return Type:
ComponentAccess
BundleContents
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withBundleContents(contents as BundleContents) as ComponentAccess;myComponentAccess.withBundleContents(myBundleContents);
Parameters:
contents: BundleContents
Type: BundleContents
Return Type:
ComponentAccess
Any predicate that matches will allow the Block to be broken by this ItemStack.
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withCanBreak(predicates as List<BlockPredicate>, showInTooltip as bool = true) as ComponentAccess;myComponentAccess.withCanBreak(BlockPredicate.create().of(<block:minecraft:diamond_ore>).build(), true);
Parameters:
predicates: List<BlockPredicate>
Type: List<BlockPredicate>
- The collection of predicates to test for showInTooltip: bool
(optional) Type: bool
- Whether to show the ability in the tooltip or not.
Default Value: true
Return Type:
ComponentAccess
AdventureModePredicate
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withCanBreak(predicate as AdventureModePredicate) as ComponentAccess;myComponentAccess.withCanBreak(myAdventureModePredicate);
Parameters:
predicate: AdventureModePredicate
Type: AdventureModePredicate
- The adventure mode predicate to use to determine whether the item can be used to break a block.
Return Type:
ComponentAccess
Any predicate that matches will allow the BlockItem within the ItemStack to be placed.
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withCanPlaceOn(predicates as List<BlockPredicate>, showInTooltip as bool = true) as ComponentAccess;myComponentAccess.withCanPlaceOn(BlockPredicate.create().of(<block:minecraft:dirt>).build(), myBool);
Parameters:
predicates: List<BlockPredicate>
Type: List<BlockPredicate>
- The collection of predicates to test for showInTooltip: bool
(optional) Type: bool
- Whether to show the restriction in the tooltip or not.
Default Value: true
Return Type:
ComponentAccess
AdventureModePredicate
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withCanPlaceOn(predicate as AdventureModePredicate) as ComponentAccess;myComponentAccess.withCanPlaceOn(myAdventureModePredicate);
Parameters:
predicate: AdventureModePredicate
Type: AdventureModePredicate
- The adventure mode predicate to use to determine whether the current block can be placed on another block.
Return Type:
ComponentAccess
IItemStack
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withChargedProjectiles(item as IItemStack) as ComponentAccess;myComponentAccess.withChargedProjectiles(<item:minecraft:arrow>);
Parameters:
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withChargedProjectiles(items as List<IItemStack>) as ComponentAccess;myComponentAccess.withChargedProjectiles([<item:minecraft:arrow>]);
Parameters:
Return Type:
ComponentAccess
ChargedProjectiles
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withChargedProjectiles(chargedProjectiles as ChargedProjectiles) as ComponentAccess;myComponentAccess.withChargedProjectiles(myChargedProjectiles);
Parameters:
chargedProjectiles: ChargedProjectiles
Type: ChargedProjectiles
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withContainer(contents as List<IItemStack>) as ComponentAccess;myComponentAccess.withContainer(myList);
Parameters:
contents: List<IItemStack>
Type: List<IItemStack>
Return Type:
ComponentAccess
ItemContainerContents
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withContainer(contents as ItemContainerContents) as ComponentAccess;myComponentAccess.withContainer(myItemContainerContents);
Parameters:
contents: ItemContainerContents
Type: ItemContainerContents
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withContainerLoot(lootTable as ResourceKey<LootTable>, seed as long) as ComponentAccess;myComponentAccess.withContainerLoot(myResourceKey, myLong);
Parameters:
lootTable: ResourceKey<LootTable>
Type: ResourceKey<LootTable>
seed: long
Type: long
Return Type:
ComponentAccess
SeededContainerLoot
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withContainerLoot(loot as SeededContainerLoot) as ComponentAccess;myComponentAccess.withContainerLoot(mySeededContainerLoot);
Parameters:
loot: SeededContainerLoot
Type: SeededContainerLoot
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withCreativeSlotLock();
Return Type:
ComponentAccess
MapData
Returns: The new instance with the modified data.
myComponentAccess.withCustomData({custom_ammo_thing: 1, owner: "Benji"});
Return Type:
ComponentAccess
CustomData
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withCustomData(customData as CustomData) as ComponentAccess;myComponentAccess.withCustomData(myCustomData);
Parameters:
customData: CustomData
Type: CustomData
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withCustomModelData(2);
Parameters:
value: int
Type: int
- The value to set the CustomModelData to
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withCustomModelData(data as CustomModelData) as ComponentAccess;myComponentAccess.withCustomModelData(myCustomModelData);
Parameters:
data: CustomModelData
Type: CustomModelData
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withCustomName(Component.literal("Fancy Water"));
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withDamage(16);
Parameters:
damage: int
Type: int
- The new damage of the ComponentAccess.
Return Type:
ComponentAccess
DebugStickState
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withDebugStickState(state as DebugStickState) as ComponentAccess;myComponentAccess.withDebugStickState(myDebugStickState);
Parameters:
state: DebugStickState
Type: DebugStickState
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withDyedColor(rgb as int, showInTooltip as bool = true) as ComponentAccess;myComponentAccess.withDyedColor(0xFFFF00, true);
Parameters:
rgb: int
Type: int
- The colour to dye this item with showInTooltip: bool
(optional) Type: bool
- Whether to show this information in a tooltip
Default Value: true
Return Type:
ComponentAccess
DyedItemColor
Returns: The new instance with the modified data.
myComponentAccess.withDyedColor(myDyedItemColor);
Parameters:
color: DyedItemColor
Type: DyedItemColor
Return Type:
ComponentAccess
Enchantment
and level.Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withEnchantment(enchantment as Enchantment, level as int = 1) as ComponentAccess;myComponentAccess.withEnchantment(<enchantment:minecraft:efficiency>, 4);
Parameters:
level: int
(optional) Type: int
- The level of the enchantment to set
Default Value: 1
Return Type:
ComponentAccess
If it is false, the item will never render the enchantment glint If it is true, the item will render the enchantment glint always, indenpendently of whether it is enchanted or not.
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withEnchantmentGlintOverride(value as bool) as ComponentAccess;myComponentAccess.withEnchantmentGlintOverride(true);
Parameters:
value: bool
Type: bool
- The value of the override, as described above
Return Type:
ComponentAccess
ItemEnchantments
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withEnchantments(enchantments as ItemEnchantments) as ComponentAccess;myComponentAccess.withEnchantments(myItemEnchantments);
Parameters:
enchantments: ItemEnchantments
Type: ItemEnchantments
Return Type:
ComponentAccess
MapData
Returns: The new instance with the modified data.
myComponentAccess.withEntityData(myMapData);
Return Type:
ComponentAccess
CustomData
Returns: The new instance with the modified data.
myComponentAccess.withEntityData(myCustomData);
Parameters:
data: CustomData
Type: CustomData
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withFireResistant();
Return Type:
ComponentAccess
FireworkExplosion
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withFireworkExplosion(explosion as FireworkExplosion) as ComponentAccess;myComponentAccess.withFireworkExplosion(myFireworkExplosion);
Parameters:
explosion: FireworkExplosion
Type: FireworkExplosion
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withFireworks(flightDuration as int, explosions as List<FireworkExplosion>) as ComponentAccess;myComponentAccess.withFireworks(myInt, myList);
Parameters:
flightDuration: int
Type: int
explosions: List<FireworkExplosion>
Type: List<FireworkExplosion>
Return Type:
ComponentAccess
Fireworks
Returns: The new instance with the modified data.
myComponentAccess.withFireworks(myFireworks);
Return Type:
ComponentAccess
FoodProperties
Returns: The new instance with the modified data.
myComponentAccess.withFood(myFoodProperties);
Parameters:
food: FoodProperties
Type: FoodProperties
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withHideAdditionalTooltip();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withHideTooltip();
Return Type:
ComponentAccess
Instrument
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withInstrument(instrument as Instrument) as ComponentAccess;myComponentAccess.withInstrument(myInstrument);
Parameters:
instrument: Instrument
Type: Instrument
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withIntangibleProjectile();
Return Type:
ComponentAccess
Component
Returns: The new instance with the modified data.
myComponentAccess.withItemName(Component.literal("Fancy Water"));
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withLock(myString);
Parameters:
code: string
Type: string
Return Type:
ComponentAccess
LockCode
Returns: The new instance with the modified data.
myComponentAccess.withLock(myLockCode);
Return Type:
ComponentAccess
LodestoneTracker
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withLodestoneTracker(tracker as LodestoneTracker) as ComponentAccess;myComponentAccess.withLodestoneTracker(myLodestoneTracker);
Parameters:
tracker: LodestoneTracker
Type: LodestoneTracker
Return Type:
ComponentAccess
Component
>Returns: The new instance with the modified data.
myComponentAccess.withLore([Component.literal("Found in a dark cave"), Component.translatable("Belonged to a Dragon")]);
Parameters:
Return Type:
ComponentAccess
myComponentAccess.withLore(myComponent);
Return Type:
ComponentAccess
ItemLore
Returns: The new instance with the modified data.
myComponentAccess.withLore(myItemLore);
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withMapColor(0xFF0000);
Parameters:
rgb: int
Type: int
- The new map colour
Return Type:
ComponentAccess
MapItemColor
Returns: The new instance with the modified data.
myComponentAccess.withMapColor(myMapItemColor);
Parameters:
color: MapItemColor
Type: MapItemColor
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withMapDecorations(decorations as MapDecorationsEntry[string]) as ComponentAccess;myComponentAccess.withMapDecorations(myMap);
Parameters:
decorations: MapDecorationsEntry[string]
Type: MapDecorationsEntry[string]
Return Type:
ComponentAccess
MapDecorations
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withMapDecorations(decorations as MapDecorations) as ComponentAccess;myComponentAccess.withMapDecorations(myMapDecorations);
Parameters:
decorations: MapDecorations
Type: MapDecorations
Return Type:
ComponentAccess
A map id is only useful after the game generates one to store data. Therefore, you should always pass in the parameter for an id you know is available.
Returns: The new instance with the modified data.
myComponentAccess.withMapId(myInt);
Parameters:
id: int
Type: int
Return Type:
ComponentAccess
MapId
Returns: The new instance with the modified data.
myComponentAccess.withMapId(myMapId);
Return Type:
ComponentAccess
MapPostProcessing
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withMapPostProcessing(value as MapPostProcessing) as ComponentAccess;myComponentAccess.withMapPostProcessing(myMapPostProcessing);
Parameters:
value: MapPostProcessing
Type: MapPostProcessing
Return Type:
ComponentAccess
It is likely that you need to call withDamage(0) in order for some things to function properly.
Returns: The new instance with the modified data.
myComponentAccess.withMaxDamage(1024);
Parameters:
maxDamage: int
Type: int
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withMaxStackSize(16);
Parameters:
maxStackSize: int
Type: int
- The new maxStackSize of the ComponentAccess.
Return Type:
ComponentAccess
ResourceLocation
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withNoteBlockSound(sound as ResourceLocation) as ComponentAccess;myComponentAccess.withNoteBlockSound(myResourceLocation);
Parameters:
sound: ResourceLocation
Type: ResourceLocation
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withOminousBottleAmplifier(amplifier as int) as ComponentAccess;myComponentAccess.withOminousBottleAmplifier(myInt);
Parameters:
amplifier: int
Type: int
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutAttributeModifiers();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutBannerPatterns();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutBaseColor();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutBees();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutBlockEntityData();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutBlockState();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutBucketEntityData();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutBundleContents();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutCanBreak();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutCanPlaceOn();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutChargedProjectiles();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutContainer();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutContainerLoot();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutCreativeSlotLock();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutCustomData();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutCustomModelData();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutCustomName();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutDamage();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutDebugStickState();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutDyedColor();
Return Type:
ComponentAccess
Enchantment
from the ComponentAccess.Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withoutEnchantment(enchantment as Enchantment) as ComponentAccess;myComponentAccess.withoutEnchantment(<enchantment:minecraft:mending>);
Parameters:
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutEnchantmentGlintOverride();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutEnchantments();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutEntityDate();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutFireResistant();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutFireworkExplosion();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutFireworks();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutFood();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutHideAdditionalTooltip();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutHideTooltip();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutInstrument();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutIntangibleProjectile();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutItemName();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutLock();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutLodestoneTracker();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutLore();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutMapColor();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutMapDecorations();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutMapId();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutMapPostProcessing();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutMaxDamage();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutMaxStackSize();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutNoteBlockSound();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutOminousBottleAmplifier();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutPotDecorations();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutPotionContents();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutProfile();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutRarity();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutRecipes();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutRepairCost();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutStoredEnchantments();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutSuspiciousStewEffects();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutTool();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutTrim();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutUnbreakable();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutWritableBookContent();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withoutWrittenBookContent();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withPotDecorations(back as ItemDefinition, left as ItemDefinition, right as ItemDefinition, front as ItemDefinition) as ComponentAccess;myComponentAccess.withPotDecorations(myItem, myItem, myItem, myItem);
Parameters:
back: ItemDefinition
Type: ItemDefinition
left: ItemDefinition
Type: ItemDefinition
right: ItemDefinition
Type: ItemDefinition
front: ItemDefinition
Type: ItemDefinition
Return Type:
ComponentAccess
PotDecorations
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withPotDecorations(decorations as PotDecorations) as ComponentAccess;myComponentAccess.withPotDecorations(myPotDecorations);
Parameters:
decorations: PotDecorations
Type: PotDecorations
Return Type:
ComponentAccess
Potion
and no custom effects
Returns: The new instance with the modified data.
myComponentAccess.withPotionContents(<potion:minecraft:swiftness>);
Return Type:
ComponentAccess
Potion
and the given
MobEffectInstance
effects.Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withPotionContents(potion as Potion, customEffects as List<MobEffectInstance>) as ComponentAccess;myComponentAccess.withPotionContents(<potion:minecraft:swiftness>, [MobEffectInstance.of(<mobeffect:minecraft:strength>, 20 * 20, 1, false, false, true)]);
Parameters:
customEffects: List<MobEffectInstance>
Type: List<MobEffectInstance>
- The effects to grant upon consuming this potion.
Return Type:
ComponentAccess
Potion
and the given
MobEffectInstance
effects.Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withPotionContents(potion as Potion, customColor as int, customEffects as List<MobEffectInstance>) as ComponentAccess;myComponentAccess.withPotionContents(<potion:minecraft:swiftness>, 0xFFFFFF00, [MobEffectInstance.of(<mobeffect:minecraft:strength>, 20 * 20, 1, false, false, true)]);
Parameters:
customColor: int
Type: int
- The ARGB color the potion will have. customEffects: List<MobEffectInstance>
Type: List<MobEffectInstance>
- The effects to grant upon consuming this potion.
Return Type:
ComponentAccess
PotionContents
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withPotionContents(contents as PotionContents) as ComponentAccess;myComponentAccess.withPotionContents(myPotionContents);
Parameters:
contents: PotionContents
Type: PotionContents
Return Type:
ComponentAccess
ResolvableProfile
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withProfile(profile as ResolvableProfile) as ComponentAccess;myComponentAccess.withProfile(myResolvableProfile);
Parameters:
profile: ResolvableProfile
Type: ResolvableProfile
Return Type:
ComponentAccess
Rarity
Returns: The new instance with the modified data.
myComponentAccess.withRarity(<constant:minecraft:item/rarity:epic>);
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withRecipes(recipes as List<ResourceLocation>) as ComponentAccess;myComponentAccess.withRecipes(myList);
Parameters:
recipes: List<ResourceLocation>
Type: List<ResourceLocation>
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myComponentAccess.withRepairCost(20);
Parameters:
cost: int
Type: int
- The repair cost
Return Type:
ComponentAccess
ItemEnchantments
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withStoredEnchantments(enchantments as ItemEnchantments) as ComponentAccess;myComponentAccess.withStoredEnchantments(myItemEnchantments);
Parameters:
enchantments: ItemEnchantments
Type: ItemEnchantments
Return Type:
ComponentAccess
SuspiciousStewEffects
SuspiciousStewEffects.Entry is effectively a pair of Effect and duration.
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withSuspiciousStewEffects(effects as List<SuspiciousStewEffectsEntry>) as ComponentAccess;myComponentAccess.withSuspiciousStewEffects(myList);
Parameters:
effects: List<SuspiciousStewEffectsEntry>
Type: List<SuspiciousStewEffectsEntry>
- The list of effects to grant on consumption.
Return Type:
ComponentAccess
SuspiciousStewEffects
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withSuspiciousStewEffects(suspiciousStewEffects as SuspiciousStewEffects) as ComponentAccess;myComponentAccess.withSuspiciousStewEffects(mySuspiciousStewEffects);
Parameters:
suspiciousStewEffects: SuspiciousStewEffects
Type: SuspiciousStewEffects
Return Type:
ComponentAccess
Tool
instance is constructed from the parameters.Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withTool(rules as List<ToolRule>, defaultMiningSpeed as float, damagePerBlock as int) as ComponentAccess;myComponentAccess.withTool([ToolRule.minesAndDrops(<tag:blocks:minecraft:planks>, 6.0f)], 0.25f, 1);
Parameters:
Return Type:
ComponentAccess
Tool
Returns: The new instance with the modified data.
myComponentAccess.withTool(myTool);
Return Type:
ComponentAccess
ArmorTrim
Returns: The new instance with the modified data.
myComponentAccess.withTrim(myArmorTrim);
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withUnbreakable(showInTooltip as bool = true) as ComponentAccess;myComponentAccess.withUnbreakable(myBool);
Parameters:
showInTooltip: bool
(optional) Type: bool
- Whether to show that the ComponentAccess is unbreakable in a tooltip.
Default Value: true
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withUnbreakable(unbreakable as Unbreakable) as ComponentAccess;myComponentAccess.withUnbreakable(myUnbreakable);
Parameters:
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withWritableBookContent(pages as List<Filterable<string>>) as ComponentAccess;myComponentAccess.withWritableBookContent(myList);
Parameters:
pages: List<Filterable<string>>
Type: List<Filterable<string>>
Return Type:
ComponentAccess
WritableBookContent
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withWritableBookContent(content as WritableBookContent) as ComponentAccess;myComponentAccess.withWritableBookContent(myWritableBookContent);
Parameters:
content: WritableBookContent
Type: WritableBookContent
Return Type:
ComponentAccess
WrittenBookContent
Returns: The new instance with the modified data.
// ComponentAccess<T : ComponentAccess>.withWrittenBookContent(content as WrittenBookContent) as ComponentAccess;myComponentAccess.withWrittenBookContent(myWrittenBookContent);
Parameters:
content: WrittenBookContent
Type: WrittenBookContent
Return Type:
ComponentAccess
myComponentAccess.writableBookContent
Return Type:
WritableBookContent
myComponentAccess.writtenBookContent
Return Type:
WrittenBookContent