Options
All
  • Public
  • Public/Protected
  • All
Menu

A module that adds bunch of new features that can be applied to vanilla or custom items. Remember that not all the methods support vanilla items, because of some technical peculiarities.

since

1.0

Index

Functions

  • addTooltip(id: number, callback: OnTooltipCallback, priority?: number, isCallbackForced?: boolean): void
  • Adds custom modification to the item tooltip. It is better than InnerCore's Item.registerNameOverrideFunction, because exactly the hover text and not the item name is being modified.

    since

    3.0

    Parameters

    • id: number

      numeric ID of the item to apply this callback to, vanilla supported

    • callback: OnTooltipCallback

      function that takes tooltip represented by the list of strings, which you can modify in any way, as the second parameter, and also item instance as the first parameter and Level object as the third

    • Optional priority: number

      callback priority, the more it is, the earlier than other callbacks your callback will be called, default is 0

    • Optional isCallbackForced: boolean

      default is true, you can set it to false, if your tooltip doesn't have any volatile components, then your tooltip will be called 4 times less often than the ones with this param set to true, which will reduce a tiny performance loss.

    Returns void

  • isFood(id: number): boolean
  • since

    1.4

    Parameters

    • id: number

    Returns boolean

    true if the item with given ID is a food, false otherwise

  • newFoodSaturationModifier(name: any_string, value: number): void
  • Registers new string food saturation modifier that can be used in food properties JSON object. Currently there are 6 pre-defined modifiers in vanilla:

    • "poor" - 0.2
    • "low" - 0.6
    • "normal" - 1.2
    • "good" - 1.6
    • "max" - 2.0
    • "supernatural" - 2.4
    since

    1.4

    Parameters

    Returns void

  • Sets the given ReachDistanceModifier object to be enabled when the player is holding the item with given ID in their hand.

    since

    3.0

    Parameters

    • id: number

      numeric ID of the item to apply the modifier to, vanilla supported

    • modifier: ReachDistanceModifier

    Returns void

  • saturationModifierFromString(name: any_string): number
  • since

    1.4

    Parameters

    Returns number

    floating point value of food saturation modifier by given name, or 1.2 (value of "normal" modifier) if the modifier by this name is not defined

  • setCannotBeRepairedInAnvil(id: number): void
  • Calling this method prevents the item with given ID to be repaired in anvil using any material or these items paired. This can be used, for example, with electric tools.

    since

    1.0

    Parameters

    • id: number

      numeric ID of the item to apply this property to, vanilla NOT supported

    Returns void

  • Sets dynamic food properties for the item with given ID, depending on the contents of the item instance.

    since

    3.0

    Parameters

    • id: number

      numeric ID of the item to apply this callback to, vanilla supported

    • callback: FoodValuesCallback

      function that takes the item instance and must return the food properties object builder with all needed properties specified for it

    Returns void

  • setExplodable(id: number, explodable: boolean): void
  • If this property is set to true, the item with given ID will be immune to any type of explosion. The only vanilla item with this property set to true is nether star. By default it's false.

    since

    1.0

    Parameters

    • id: number

      numeric ID of the item to apply this property to, vanilla supported

    • explodable: boolean

    Returns void

  • setFireResistant(id: number, fireResistant: boolean): void
  • If this property is set to true, the item with given ID will be immune to fire and lava. Talking about the vanilla items, the only items having this property set to true are netherite ingot, tools and armor. By default it's false.

    since

    1.0

    Parameters

    • id: number

      numeric ID of the item to apply this property to, vanilla supported

    • fireResistant: boolean

    Returns void

  • setFurnaceBurnIntervalMultiplier(id: number, multiplier: number): void
  • Sets the amount of items that can be smelt with a single item of given ID as a fuel.

    since

    1.0

    Parameters

    • id: number

      numeric ID of the item to apply this property to, vanilla supported

    • multiplier: number

    Returns void

  • setFurnaceXPMultiplier(id: number, multiplier: number): void
  • Sets the multiplier that will be used in calculating the amount of experience to add to a player (or to drop from a broken furnace) after smelting the item with given ID (the method must be applied to the result and not to the ingredient). Default value is 0.0, cooked meat has 0.35, golden ingot has 1.0 (1.0 = 100% chance of dropping any XP)

    since

    1.0

    Parameters

    • id: number

      numeric ID of the item to apply this property to, vanilla supported

    • multiplier: number

    Returns void

  • setIsMirroredArt(id: number, isMirroredArt: boolean): void
  • If this property is set to true, the icon of the item with given ID will be horizontally mirrored in container slots. By default it's false. Some of the vanilla items with this property set to true are fishing rod and carrot on a stick.

    since

    1.0

    Parameters

    • id: number

      numeric ID of the item to apply this property to, vanilla supported

    • isMirroredArt: boolean

    Returns void

  • Sets dynamic maximum use duration for the item with given ID, depending on the contents of the item instance.

    since

    2.2

    Parameters

    • id: number

      numeric ID of the item to apply this callback to, vanilla NOT supported

    • callback: UseDurationCallback

      function that takes the item instance and must return max use duration value for it

    Returns void

  • setRequiresWorldBuilder(id: number, requiresWorldBuilder: boolean): void
  • If this property is set to true, the item with given ID won't be usable in adventure mode, by default it's false.

    since

    1.0

    Parameters

    • id: number

      numeric ID of the item to apply this property to, vanilla supported

    • requiresWorldBuilder: boolean

    Returns void

  • setShouldDespawn(id: number, shouldDespawn: boolean): void
  • If this property is set to true, the item with given ID will not despawn in a certain period of time after it was dropped on the ground and not picked up by anyone. There are no vanilla items with this property set to false, by default it's true.

    since

    1.0

    Parameters

    • id: number

      numeric ID of the item to apply this property to, vanilla supported

    • shouldDespawn: boolean

    Returns void

Generated using TypeDoc