Download the PHP package celestriode/constructure-target-selector without Composer

On this page you can find all versions of the php package celestriode/constructure-target-selector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package constructure-target-selector

Constructure: Target Selectors

This is an implementation of Constructure for Minecraft's target selector format.

The target selector format in Minecraft is ill-defined and even dependent on the input itself. This makes it difficult to define a general structure as one-size-fits-all. Because of this, parsing an input and defining an expected structure are more involved than is desired.

Getting started

Rather than starting with a constructure object, you will need to start with the target selector parser itself. The parser's options can be customized, and you'll find that changing the parser's options will be necessary for accurately parsing a Minecraft-specific input.

The parser

The general and default format for target selectors is:

Tokens

All tokens can be directly modified, except for the target. The following redundantly sets the tokens to their default values, but can be changed however necessary for this specific parser instance.

Target types (p, e, a, r, s)

The target will instead make use of the values within the SelectorTargets dynamic registry, from the Dynamic Minecraft Registries repository. Note that all of these repositories are empty by default, to allow you to have specific values based on the version and edition of Minecraft.

If you have no need for dynamic population, you can simply add the standard target types to the registry directly. This must be done before validation. If you are not validating input through constructure, then this is not needed.

Parameter overrides

The parser will attempt to automatically determine the type of value that the input is, based on utterly no context due to the ill-defined selector format. Expect, then, that it makes the wrong assumption.

To account for cases where the parser lacks, you can force a parameter of a specific name to adhere to a certain type. The addOverride() method takes in the name of the parameter (which accepts a dot-syntax to target nested parameters, like root.child), and a function to run that will return the value of the parameter.

For example, if nbt={} were in the input, the parser would default to using the "nested parameters" type instead of the "SNBT" type, which is incorrect. You can create an override for this case to always force it to be an SNBT value.

The following are overrides are useful for Java Edition 1.17.

Constructure

Now that the parser has been situated, you can create the constructure object.

Global audits

By default, type matching is not performed. Using type matching as a global audit can be useful, but note that global audits apply to all constructure structures in the tree. To target only values for their types, the StructureIsValue audit can be used as a predicate for the TypesMatch audit.

Simultaneously, checking for the valid negation of values will not be performed by default, instead relying on the Negation audit. As with TypesMatch, you'll want to use StructureIsValue as a predicate to ensure only values can be targeted, and not other structures within the tree.

Parsing

Now you can parse the input to generate a traversable tree.

ConversionFailure will be thrown if it fails to parse the input.

Validating

If the input needs to be validated, then an expected structure is necessary. This must be started with a root Selector object. The root will house the variety of target selectors that are supported in whatever the context is for validation.

There are a variety of target selector types already provided with the library. They are:

These can be added when necessary to the root. Nearly every bit of the structure can have an audit attached to it. With the following, the player name must be between 1 and 16 characters long.

Dynamic selectors have numerous building options. Start by creating the builder. It takes in a registry for the acceptable target types, which you will have populated earlier.

Follow-up by adding a variety of acceptable parameters. Adding a value takes the name of the parameter, and the expected type of value. The value has a few options as well, which are validated independently of audits. Options include negatable() (e.g., tag=!test) and supportsMultiple() (e.g., tag=a,tag=b).

If a parameter name is NULL, then the input may have any name at all, as long as the value matches.


Finally, run the validator.

Putting it all together

The following inputs would have the stated result:


All versions of constructure-target-selector with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-mbstring Version *
celestriode/captain Version v0.0.10-beta
celestriode/constructure Version ^0.6.5
celestriode/mattock Version v0.1.0-beta
celestriode/dynamic-minecraft-registries Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package celestriode/constructure-target-selector contains the following files

Loading the files please wait ....