Marshie's 1.18.2 Hexes

Post your coolest Hexcasting creations here.

New topics are NOT for chatting or asking help, put those in the comments of a post or in a different forum.
marshmellow
Posts: 4
Joined: Sat Feb 11, 2023 6:16 am

Marshie's 1.18.2 Hexes

Post by marshmellow »

This topic is where I'll be keeping any spells that I think are good enough for the public eye. Note that I'm playing on 1.18 here; I make 0 guarantees that anything here or the principles behind them will work in more current versions.

Veinmine
It's veinmine. Does not detect diagonal blocks (but can be easily modified to do so). Currently always ends on a mishap, either of the null reference or too many recursions variety, and this is another thing that can be fixed probably but I can't be bothered. Uses Hexal.

Code: Select all

(
	Numerical Reflection: 19	//Post-Initialization, the stack will consist of this function (for recursive cloning) and the current target vector.
	Gemini Gambit			//Each search operation uses the target vector 3 times. 6 operations * 3 = 18, plus one for the break block at the end.
	
	Vector Reflection +X		//Each of the next six chunks will: check if an adjacent block is the same as the target block;
	Add				//push that block to the list of target blocks if so; or (0,0,0) if not; then save the new list of targets to the ravenmind.
	Surveyor's Distillation
	Negation Purification
	Jester's Gambit
	Vector Reflection +X
	Add
	Gemini Decomposition
	Numerical Reflection: 3
	Fisher's Gambit
	Multiply
	Subtract
	Muninn's Reflection
	Jester's Gambit
	Integration Distillation
	Huginn's Gambit
	
	Vector Reflection -X
	Add
	Surveyor's Distillation
	Negation Purification
	Jester's Gambit
	Vector Reflection -X
	Add
	Gemini Decomposition
	Numerical Reflection: 3
	Fisher's Gambit
	Multiply
	Subtract
	Muninn's Reflection
	Jester's Gambit
	Integration Distillation
	Huginn's Gambit
	
	Vector Reflection +Y
	Add
	Surveyor's Distillation
	Negation Purification
	Jester's Gambit
	Vector Reflection +Y
	Add
	Gemini Decomposition
	Numerical Reflection: 3
	Fisher's Gambit
	Multiply
	Subtract
	Muninn's Reflection
	Jester's Gambit
	Integration Distillation
	Huginn's Gambit
	
	Vector Reflection -Y
	Add
	Surveyor's Distillation
	Negation Purification
	Jester's Gambit
	Vector Reflection -Y
	Add
	Gemini Decomposition
	Numerical Reflection: 3
	Fisher's Gambit
	Multiply
	Subtract
	Muninn's Reflection
	Jester's Gambit
	Integration Distillation
	Huginn's Gambit
	
	Vector Reflection +Z
	Add
	Surveyor's Distillation
	Negation Purification
	Jester's Gambit
	Vector Reflection +Z
	Add
	Gemini Decomposition
	Numerical Reflection: 3
	Fisher's Gambit
	Multiply
	Subtract
	Muninn's Reflection
	Jester's Gambit
	Integration Distillation
	Huginn's Gambit
	
	Vector Reflection -Z
	Add
	Surveyor's Distillation
	Negation Purification
	Jester's Gambit
	Vector Reflection -Z
	Add
	Gemini Decomposition
	Numerical Reflection: 3
	Fisher's Gambit
	Multiply
	Subtract
	Muninn's Reflection
	Jester's Gambit
	Integration Distillation	//If you want to get diagonals, add more of these chunks.
	Huginn's Gambit			//That'll require 16 more of these. You may want to write a helper spell for that.
	
	Break Block			//Finally we use the last target vector. The stack is now empty except for a copy of this function.
	Gemini Decomposition		//Which we will copy for hermes-ing later.
	Muninn's Reflection		//Pull the current list of target blocks.
	Uniqueness Purification		//Remove all blocks that were zeroed out and any dupes.
	Gemini Decomoposition
	Numerical Reflection: 1
	Selection Distillation		//Pull the next vector
	Jester's Gambit
	Numerical Reflection: 1
	Excisor's Distillation		//Remove that vector from the list
	Huginn's Gambit			//and push to ravenmind.
	Jester's Gambit
	Hermes' Gambit			//Recursion
)

Gemini Decomposition			//Copy the function for hermes-ing later
Mind's Reflection			//Raytrace
Compass Purification
Mind's Reflection
Alidade's Purification
Archer's Distillation
Vector Reflection Zero			//Prepare the ravenmind
Singleton's Purification
Huginn's Gambit				//Initialize the ravenmind with a list containing the zero vector.
Jester's Gambit
Hermes' Gambit				//And we're off to the races
More stuff as I come up with them, suggestions for optimizations or tweaks are welcome.
marshmellow
Posts: 4
Joined: Sat Feb 11, 2023 6:16 am

Re: Marshie's 1.18.2 Hexes

Post by marshmellow »

Directional Place Block
A slightly more complicated Place Block spell that allows directional block placement, like for stairs and trapdoors and such.

Code: Select all

Mind's Reflection
Compass Purification
Mind's Reflection
Alidade's Purification
Architect's Distillation
Gemini Decomposition
Mind's Reflection
Compass Purification
Mind's Reflection
Alidade's Purification
Archer's Distillation
Jester's Gambit
Numerical Reflection: 0.5
Multiplication
Addition
Mind's Reflection
Compass Purification
Subtraction
Length Purification
Mind's Reflection
Alidade's Purification
Multiplication
Mind's Reflection
Compass Purification
Addition
Jester's Gambit
Numerical Reflection: 0.25
Multiply
Addition
Place Block
Last edited by marshmellow on Sun Feb 26, 2023 4:28 pm, edited 1 time in total.
User avatar
kristi fristi
Posts: 26
Joined: Mon Dec 12, 2022 7:23 am

what is directional supposed to do?

Post by kristi fristi »

how is directional place block supposed to work? when i try to use it wants to place blocks outside my ambit
marshmellow
Posts: 4
Joined: Sat Feb 11, 2023 6:16 am

Re: Marshie's 1.18.2 Hexes

Post by marshmellow »

Oh dear, I'll go over my code later to see if I missed an addition or subtraction somewhere.

The place block spell can actually place directional blocks based on the octant of the block that it's cast in. However, since hexcasting usually works in centers of blocks, place block is pretty much always cast at (0.5, 0.5, 0.5). To fix this, we can take an archers and an architects and work backwards to find the exact point on the block where your raycast hit, then move it along the normal so that it's comfortably inside the coordinates we want to place at.

First, we get archers + architects. then, we add half an architects to archers in order to get the face of the block we're placing against. Next, get the distance from the caster to the face of the block, multiply our look vector by that distance, and add it to our position to get the point on the block that we're looking at*. Finally we add a quarter of an architects to get the final position to use place block on.

*this formula is not actually exact and will become less accurate as distance increases. The exact formula isn't that much more complicated, but right now it looks very ugly and nobody wants to see that.

edit: I MISSED a multiplication after Numerical Reflection: 0.5
Last edited by marshmellow on Sun Feb 26, 2023 4:29 pm, edited 1 time in total.
User avatar
petrakat
Posts: 10
Joined: Fri Dec 02, 2022 12:02 am

Re: Marshie's 1.18.2 Hexes

Post by petrakat »

Wait, it can place blocks directionally?

wow, the more you know :-) I just use vanilla's code for it
The creator of petrak@'s mods. Partially a test account, partially for me to chat in a non-admin capacity... probably just a test account.
User avatar
kristi fristi
Posts: 26
Joined: Mon Dec 12, 2022 7:23 am

directional placing

Post by kristi fristi »

so I tried testing that octant thing with

Code: Select all

Mind's Reflection
Compass' Purification
Mind's Reflection
Alidade's Purification
Dioscuri Gambit
Archer's Distillation
Rotation Gambit II
Architect's Distillation
Additive Distillation
{
   [(-0.25, -0.25, -0.25), (0.25, -0.25, -0.25), (-0.25, 0.25, -0.25), (0.25, 0.25, -0.25), 
    (-0.25, -0.25, 0.25), (0.25, -0.25, 0.25), (-0.25, 0.25, 0.25), (0.25, 0.25, 0.25)]
}
Scribe's Reflection	//using abacus to select octant
Selection Distillation
Additive Distillation
Place Block
but it doesn't seem to influence the direction of a block
marshmellow
Posts: 4
Joined: Sat Feb 11, 2023 6:16 am

Re: Marshie's 1.18.2 Hexes

Post by marshmellow »

After a bit more testing, it looks like only the top or bottom orientation is determined by placement location, with the N/E/S/W orientation determined by the player's look direction. This only works in 1.18.2, though; I don't know what changed for 1.19.2, but it's no longer possible to place a block in an upper orientation by moving the target vector.
User avatar
kristi fristi
Posts: 26
Joined: Mon Dec 12, 2022 7:23 am

Post by kristi fristi »

:(