Skip to content

AStages Item Restriction (OLD)

Kessy edited this page Mar 1, 2025 · 1 revision

AStages Item Restriction (OLD)

Overview

Item Restrictions allow you to control the usage, placing, or possession of specific items within the game. These restrictions can be applied globally or on a per-player basis, enabling fine-tuned gameplay customization. This feature is useful for creating unique progression systems, balancing gameplay, or enforcing server rules.


Methods

Method Description Parameters Returns
AStages.addRestrictionForItem(id, stage, items...) Create and add generic item restriction. id: arbitrary string used as identifier.
stage: progression stage.
items: variadic parameter of items.
AItemRestriction
AStages.addRestrictionForPredicate(id, stage, predicate) Create and add item restriction based on predicate condition. id: arbitrary string used as identifier.
stage: progression stage.
predicate: predicate tester.
AItemRestriction
AStages.addRestrictionForMod(id, stage, mod) Create and add item restriction for all items owned by the same mod. id: arbitrary string used as identifier.
stage: progression stage.
mod: mod id to be restricted.
AItemRestriction
AStages.addRestrictionForMod(id, stage, mod, ignored...) Create and add item restriction for all items owned by the same mod, with blacklist. id: arbitrary string used as identifier.
stage: progression stage.
mod: mod id to be restricted.
ignored: variadic parameter to specify all items that must be ignored.
AItemRestriction
AStages.addRestrictionForTag(id, stage, tag) Create and add item restriction for all items that have same tag. id: arbitrary string used as identifier.
stage: progression stage.
tag: tag to be restricted.
AItemRestriction
AStages.addRestrictionForTag(id, stage, tag, ignoredTags...) Create and add item restriction for all items that have same tag, with blacklist based on other tags. id: arbitrary string used as identifier.
stage: progression stage.
tag: tag to be restricted.
ignoredTags : variadic parameter to specify all tags that must be ignored.
AItemRestriction
AStages.addRestrictionForTagAndBlacklistItems(id, stage, tag, ignoredItems...) Create and add item restriction for all items that have same tag, with blacklist based on items. id: arbitrary string used as identifier.
stage: progression stage.
tag: tag to be restricted.
ignoredItems : variadic parameter to specify all items that must be ignored.
AItemRestriction
AStages.addRestrictionForArmor(id, stage, armor...) Create and add item restriction for armor (more specific restriction, you can use the generic one and set properties). id: arbitrary string used as identifier.
stage: progression stage.
armor: items to be restricted.
AItemRestriction

Examples

Basic Usage

// Server Script Folder -> file.js (arbitrary file name).
AStages.addRestrictionForItem("astages/item1", "stage_item", Items.OAK_LOG, "chest")
AStages.addRestrictionForTag("astages/item2", "stage_item", "forge:ingots/iron")
AStages.addRestrictionForArmor("astages/item3", "stage_item", "diamond_helmet", "diamond_chestplate")
AStages.addRestrictionForPredicate("astages/item4", "stage_item", stack => stack.is("minecraft:oak_planks"))
AStages.addRestrictionForMod("astages/item5", "stage_item", "minecraft")
AStages.addRestrictionForMod("astages/item6", "stage_item", "minecraft", "oak_log", "oak_planks") // Ignored: all items NOT included in the restriction!

Properties

Note

You don't need to set all properties for each restriction: changes should be done only when you want to modify default values!

// Server Script Folder -> file.js (arbitrary file name).
AStages.addRestrictionForItem("astages/item1", "stage_item", Items.OAK_LOG, "chest")
    .setPickUpDelay(60)
    .setCanAttack(false)
    .setCanBeStoredInInventory(false)
    .setCanBeEquipped(false)
    .setCanPickedUp(false)
    .setHideTooltip(true) // Tooltip when mouse is hover an item
    .setRenderItemName(false) // Item name above hotbar
    .setHideInJEI(true) // If JEI/REI mod is installed
    .setCanBePlaced(false)
    @Deprecated("0.2.2") .setCanBlockBeUsed(false) // Like open inventory
    @Deprecated("0.7.0") .setCanItemBeUsed(false) // Like lit fire with flint and steel
    .setCanItemBeLeftClicked(false)
    .setCanItemBeRightClicked(false)
    .setCanInteractWithBlock(false)
    .setCanBeDig(true)
    .setDropMessage(stack => Component.literal("Custom message for item ").append(stack.getHoverName()).withStyle("green"))
    .setAttackMessage(stack => ...)
    .setPickupMessage(stack => ...)
    .setUsageMessage(stack => ...)
    .setMineMessage(stack => ...)
    .setPlaceMessage(stack => ...)
    .setJadeItemMessage(stack => ...)
    .setJadeBlockMessage(stack => ...)

Documentation:

  1. Home

  2. Stages
    - Usage
    - Utils

  3. Restrictions
    - Crop
    - Dimension
    - Effect
    - Enchant
    - Item (Old)
    - Loot
    - Mob
    - Ore
    - Pet
    - Recipe
    - Region
    - Screen
    - Structure

  4. Addons
    - Curios API
    - FTB Quests
    - Pufferfish Skill's

  5. Simple Restrictions (via commands)
    Brand new and intuitive way to add restriction!

  6. Developers
    - Plugin
    - Restrictions
    - Simple Restrictions
    - Stage System
    - Utils

  7. Q&A
    A place where questions are on the agenda!

  8. Changelogs
    Changelogs since 0.6.0 version!

  9. Version Comparisons

  10. What's Happened? (FLOP!)
    New code formatting is coming!

Clone this wiki locally