Hex Casting

Hex Casting

6M Downloads

[FEATURE] String data type and inventory spells

GameGuruGreenGryphon opened this issue ยท 1 comments

commented

Add a string data type to fit with the Vec3, Entity reference, and pattern data types used in Hex Casting.
A string could work exactly like a typical programming language's string data type, but there's no good reason to do string manipulation unless you have a keyboard input for strings.

Reasoning

Writing spells that do item and inventory management on-the-fly is a powerful thing given Minecraft's admittedly poor personal tools of automation, and strings seem to be the only reasonable way to do this.
Think of a trinket that instantly teleports all mob drops in your inventory into a dedicated chest at your base, or one that summons a flurry of arrows that instantly home in on the nearest enemies.
This might step on the toes of a lot of other spells in this mod like Ignite, Conjure Water, Conjure Lava, Overgrow, Place Block, and Explosion, given a dispenser's functionality.

Patterns

Get name
any -> string
Returns the name of the iota given.
Entities return their name, and return their new name if they have a name tag.
Vectors return the name of the block at the location, and if it's air, returns NULL, for the logical operators.
Lists throw an error.
Patterns as iota return the name of the spell, for whatever reason.
Strings return themselves.

Get inventory
any -> list
Returns a list of items inside the given any, with the list containing only unique strings of item names.
If there are 5 stacks of cobblestone and 2 stacks of obsidian in the given inventory, this pattern would return ["Cobblestone", "Obsidian"]
If the input does not have an inventory, throw an error.

Spells

Dispense item
any, string, vector, vector ->
Replicates dispenser functionality at a given location.
Any is the target inventory, string targets the first stack of items with the given name, first vector is the position to spawn the item, second vector is the face vector closest to the given vector.
A stack of (0.50, 64.50, 0.50), "Stone", (0.50, 68.50, 0.50), (1.0, 0.0, 0.0) will summon a max of 64 stone at (0.50, 68.50, 0.50) from the block entity at (0.50, 64.50, 0.50), travelling +X.
If string is "Shears", it will shear any block 1 block in the +X direction from the target vector.
If string is "Player Head", it will place the head facing the +X direction adjacent to the target vector.

Drop item
Same functionality as Dispense Item but always inserts the item into an adjacent inventory, or drops the item if there is none, like a dropper. Can be used to transfer massive quantities of items.

Other applications

String data types could be used to differentiate between things in the world, such as logs, leaves, ores, mobs, and more.
Using a list of similar blocks to break would be an effective vein mining tool.
Using a list of blocks to break, but not breaking anything else other than the list of strings, could make for a fine-tuned excavation tool.
Using a list of mobs can further narrow down what entities you actually want to target, rather than the broad zone distillation categories.
Having a list of item names and dedicated vectors where chests are, you can create a sorting system.
And possibly more stuff in the future.

commented

... This is very much out of scope, unfortunately. I do recognize the utility in having "discriminators," but if I were to add anything like this I'd either implement them as patterns or equality/"likeness" checks with a template.