Package dev.latvian.mods.kubejs.item
Class ItemBuilder
java.lang.Object
dev.latvian.mods.kubejs.registry.BuilderBase<net.minecraft.world.item.Item>
dev.latvian.mods.kubejs.registry.ModelledBuilderBase<net.minecraft.world.item.Item>
dev.latvian.mods.kubejs.item.ItemBuilder
- All Implemented Interfaces:
Supplier<net.minecraft.world.item.Item>
- Direct Known Subclasses:
ArmorItemBuilder,BlockItemBuilder,FluidBucketItemBuilder,HandheldItemBuilder,ShearsItemBuilder,SmithingTemplateItemBuilder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final recordstatic interfacestatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionnet.minecraft.world.item.UseAnimToIntFunction<net.minecraft.world.item.ItemStack> intbooleanbooleanbooleannet.minecraft.world.item.component.ItemAttributeModifiersnet.minecraft.world.item.JukeboxPlayableintintnet.minecraft.world.item.RarityFunction<net.minecraft.world.item.ItemStack, Collection<net.minecraft.world.item.ItemStack>> @Nullable ItemTintFunctionnet.minecraft.world.item.component.Toolfinal List<net.minecraft.network.chat.Component> ToIntBiFunction<net.minecraft.world.item.ItemStack, net.minecraft.world.entity.LivingEntity> Fields inherited from class dev.latvian.mods.kubejs.registry.ModelledBuilderBase
baseTexture, modelGenerator, parentModel, texturesFields inherited from class dev.latvian.mods.kubejs.registry.BuilderBase
defaultTags, displayName, dummyBuilder, formattedDisplayName, id, object, registryKey, sourceLine, translationKey -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbarWidth(ToIntFunction<net.minecraft.world.item.ItemStack> barWidth) color(int index, ItemTintFunction color) color(ItemTintFunction callback) <T> ItemBuildercomponent(net.minecraft.core.component.DataComponentType<T> type, T value) containerItem(net.minecraft.resources.ResourceLocation id) net.minecraft.world.item.Item.Propertiesnet.minecraft.world.item.ItemfinishUsing(ItemBuilder.FinishUsingCallback finishUsing) fireResistant(boolean isFireResistant) food(int nutrition, float saturation) food(Consumer<FoodBuilder> b) voidgenerateAssets(KubeAssetGenerator generator) protected voidgenerateItemModels(KubeAssetGenerator generator) glow(boolean v) Deprecated.hurtEnemy(Predicate<ItemBuilder.HurtEnemyContext> context) jukeboxPlayable(net.minecraft.resources.ResourceKey<net.minecraft.world.item.JukeboxSong> song) jukeboxPlayable(net.minecraft.resources.ResourceKey<net.minecraft.world.item.JukeboxSong> song, boolean showInTooltip) maxDamage(int v) maxStackSize(int v) name(ItemBuilder.NameCallback name) rarity(net.minecraft.world.item.Rarity v) releaseUsing(ItemBuilder.ReleaseUsingCallback releaseUsing) subtypes(Function<net.minecraft.world.item.ItemStack, Collection<net.minecraft.world.item.ItemStack>> fn) tooltip(net.minecraft.network.chat.Component text) net.minecraft.world.item.ItemtransformObject(net.minecraft.world.item.Item obj) useAnimation(net.minecraft.world.item.UseAnim animation) useDuration(ToIntBiFunction<net.minecraft.world.item.ItemStack, net.minecraft.world.entity.LivingEntity> useDuration) Methods inherited from class dev.latvian.mods.kubejs.registry.ModelledBuilderBase
modelGenerator, parentModel, texture, texture, texturesMethods inherited from class dev.latvian.mods.kubejs.registry.BuilderBase
createAdditionalObjects, createTransformedObject, displayName, formattedDisplayName, formattedDisplayName, generateData, generateLang, get, getBuilderTranslationKey, getTranslationKeyGroup, newID, tag, toString, translationKey
-
Field Details
-
components
-
maxStackSize
public transient int maxStackSize -
maxDamage
public transient int maxDamage -
burnTime
public transient int burnTime -
subtypes
public transient Function<net.minecraft.world.item.ItemStack,Collection<net.minecraft.world.item.ItemStack>> subtypes -
rarity
public transient net.minecraft.world.item.Rarity rarity -
fireResistant
public transient boolean fireResistant -
glow
public transient boolean glow -
tooltip
-
tint
-
foodBuilder
-
barColor
-
barWidth
-
nameGetter
-
anim
public transient net.minecraft.world.item.UseAnim anim -
useDuration
public transient ToIntBiFunction<net.minecraft.world.item.ItemStack,net.minecraft.world.entity.LivingEntity> useDuration -
use
-
finishUsing
-
releaseUsing
-
hurtEnemy
-
jukeboxPlayable
public transient net.minecraft.world.item.JukeboxPlayable jukeboxPlayable -
tool
public transient net.minecraft.world.item.component.Tool tool -
itemAttributeModifiers
public transient net.minecraft.world.item.component.ItemAttributeModifiers itemAttributeModifiers -
canRepair
public transient boolean canRepair
-
-
Constructor Details
-
ItemBuilder
public ItemBuilder(net.minecraft.resources.ResourceLocation id)
-
-
Method Details
-
createObject
public net.minecraft.world.item.Item createObject()- Specified by:
createObjectin classBuilderBase<net.minecraft.world.item.Item>
-
transformObject
public net.minecraft.world.item.Item transformObject(net.minecraft.world.item.Item obj) - Overrides:
transformObjectin classBuilderBase<net.minecraft.world.item.Item>
-
generateAssets
- Overrides:
generateAssetsin classBuilderBase<net.minecraft.world.item.Item>
-
generateItemModels
-
component
-
maxStackSize
-
unstackable
@Info("Makes the item not stackable, equivalent to setting the item\'s max stack size to 1.") public ItemBuilder unstackable() -
maxDamage
@Info("Sets the item\'s max damage. Default is 0 (No durability).") public ItemBuilder maxDamage(int v) -
burnTime
@Info("Sets the item\'s burn time. Default is 0 (Not a fuel).") public ItemBuilder burnTime(TickDuration v) -
containerItem
@Info("Sets the item\'s container item, e.g. a bucket for a milk bucket.") public ItemBuilder containerItem(net.minecraft.resources.ResourceLocation id) -
subtypes
@Info("Adds subtypes to the item. The function should return a collection of item stacks, each with a different subtype.\n\nEach subtype will appear as a separate item in JEI and the creative inventory.\n") public ItemBuilder subtypes(Function<net.minecraft.world.item.ItemStack, Collection<net.minecraft.world.item.ItemStack>> fn) -
rarity
-
glow
@Info("Makes the item glow like enchanted, even if it\'s not enchanted.") public ItemBuilder glow(boolean v) -
tooltip
@Info("Adds a tooltip to the item.") public ItemBuilder tooltip(net.minecraft.network.chat.Component text) -
group
Deprecated. -
color
@Info("Colorizes item\'s texture of the given index. Index is used when you have multiple layers, e.g. a crushed ore (of rock + ore).") public ItemBuilder color(int index, ItemTintFunction color) -
color
@Info("Colorizes item\'s texture of the given index. Useful for coloring items, like GT ores ore dusts.") public ItemBuilder color(ItemTintFunction callback) -
barColor
@Info("Determines the color of the item\'s durability bar. Defaulted to vanilla behavior.") public ItemBuilder barColor(Function<net.minecraft.world.item.ItemStack, KubeColor> barColor) -
barWidth
@Info("Determines the width of the item\'s durability bar. Defaulted to vanilla behavior.\n\nThe function should return a value between 0 and 13 (max width of the bar).\n") public ItemBuilder barWidth(ToIntFunction<net.minecraft.world.item.ItemStack> barWidth) -
name
@Info("Sets the item\'s name dynamically.\n") public ItemBuilder name(ItemBuilder.NameCallback name) -
food
-
food
@Info("Set the food nutrition and saturation of the item.\n") public ItemBuilder food(int nutrition, float saturation) -
fireResistant
@Info("Makes the item fire resistant like netherite tools (or not).") public ItemBuilder fireResistant(boolean isFireResistant) -
fireResistant
-
useAnimation
@Info("Determines the animation of the item when used, e.g. eating food.") public ItemBuilder useAnimation(net.minecraft.world.item.UseAnim animation) -
useDuration
@Info("The duration when the item is used.\n\nFor example, when eating food, this is the time it takes to eat the food.\nThis can change the eating speed, or be used for other things (like making a custom bow).\n") public ItemBuilder useDuration(ToIntBiFunction<net.minecraft.world.item.ItemStack, net.minecraft.world.entity.LivingEntity> useDuration) -
use
@Info("Determines if player will start using the item.\n\nFor example, when eating food, returning true will make the player start eating the food.\n") public ItemBuilder use(ItemBuilder.UseCallback use) -
finishUsing
@Info("When players finish using the item.\n\nThis is called only when `useDuration` ticks have passed.\n\nFor example, when eating food, this is called when the player has finished eating the food, so hunger is restored.\n") public ItemBuilder finishUsing(ItemBuilder.FinishUsingCallback finishUsing) -
releaseUsing
@Info("When players did not finish using the item but released the right mouse button halfway through.\n\nAn example is the bow, where the arrow is shot when the player releases the right mouse button.\n\nTo ensure the bow won\'t finish using, Minecraft sets the `useDuration` to a very high number (1h).\n") public ItemBuilder releaseUsing(ItemBuilder.ReleaseUsingCallback releaseUsing) -
hurtEnemy
@Info("Gets called when the item is used to hurt an entity.\n\nFor example, when using a sword to hit a mob, this is called.\n") public ItemBuilder hurtEnemy(Predicate<ItemBuilder.HurtEnemyContext> context) -
jukeboxPlayable
public ItemBuilder jukeboxPlayable(net.minecraft.resources.ResourceKey<net.minecraft.world.item.JukeboxSong> song, boolean showInTooltip) -
jukeboxPlayable
public ItemBuilder jukeboxPlayable(net.minecraft.resources.ResourceKey<net.minecraft.world.item.JukeboxSong> song) -
disableRepair
-
createItemProperties
public net.minecraft.world.item.Item.Properties createItemProperties()
-