Page 1 of 1

Marshie's 1.18.2 Hexes

Posted: Tue Feb 14, 2023 11:35 pm
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.

Re: Marshie's 1.18.2 Hexes

Posted: Sun Feb 26, 2023 7:09 am
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

what is directional supposed to do?

Posted: Sun Feb 26, 2023 10:38 am
by kristi fristi
how is directional place block supposed to work? when i try to use it wants to place blocks outside my ambit

Re: Marshie's 1.18.2 Hexes

Posted: Sun Feb 26, 2023 4:26 pm
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

Re: Marshie's 1.18.2 Hexes

Posted: Sun Feb 26, 2023 4:28 pm
by petrakat
Wait, it can place blocks directionally?

wow, the more you know :-) I just use vanilla's code for it

directional placing

Posted: Sun Feb 26, 2023 5:26 pm
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

Re: Marshie's 1.18.2 Hexes

Posted: Sun Feb 26, 2023 7:01 pm
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.

Posted: Sun Feb 26, 2023 7:03 pm
by kristi fristi
:(