Skip to content

AStages Structure Restriction

Kessy edited this page Feb 2, 2025 · 8 revisions

AStages Structure Restriction

Overview

Caution

Everything written in this page can be referred only to versions above 0.7.0!

Structure Restrictions allow you to control access to or interaction with specific structures within the game. This includes limiting entry, preventing interactions with blocks or entities within the structure, or restricting the explosion that can happen. These restrictions are useful for creating progression-based exploration, protecting important areas, or ensuring that specific structures are only accessible under certain conditions.


Methods

Method Description Parameters Returns
AStages.addRestrictionForStructure(id, stage, structure...) Create and add generic structure restriction. id: arbitrary string used as identifier.
stage: progression stage.
structure: all structures to be restricted.
AStructureRestriction

Examples

Basic Usage

// Server Script Folder -> file.js (arbitrary file name).
AStages.addRestrictionForStructure("astages/structure", "stage_structure", "minecraft:pillager_outpost")

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.addRestrictionForStructure("astages/structure", "stage_structure", "minecraft:pillager_outpost")
    .setCanAttackEntities(false)
    .setCanEnter(false) @NotYetImplemented
    .setCanInteract(false)
    .setCanBlockBePlaced(false)
    .setCanBlockBeBroken(false)
    .setMakeExplosionsAffectBlocks(false)
    .setMakeExplosionsAffectEntities(false)
    .addAllowedBreakableBlocks('iron_bars') // EXAMPLE: for demonstration purposes only!
    .addAllowedPlaceableBlocks('cobblestone', 'stone_bricks') // EXAMPLE: for demonstration purposes only!
    .addAllowedInteractableBlocks('chest') // EXAMPLE: for demonstration purposes only!
    .addAllowedBreakableStates(Blocks.COBBLESTONE.defaultBlockState()) // EXAMPLE: for demonstration purposes only!
    .addAllowedPlaceableStates(Blocks.COBBLESTONE.defaultBlockState()) // EXAMPLE: for demonstration purposes only!
    .addAllowedInteractableStates(Blocks.CHEST.defaultBlockState()) // EXAMPLE: for demonstration purposes only!
    .addAllowedTargetableEntities('minecraft:pillager') // EXAMPLE: for demonstration purposes only!
    .setAttackMessage(structure => Component.literal("Custom message for structure ").append(structure.getHoverName()).withStyle("green"))
    .setInteractMessage(structure => ...)
    .setEnterMessage(structure => ...)
    .setPlaceMessage(structure => ...)
    .setBreakMessage(structure => ...)

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
    - 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