enjarai / trickster

A Minecraft mod about magic, creativity, and trickery.
https://modrinth.com/mod/trickster
MIT License
1 stars 5 forks source link

Add Shadow (Echo?) Ploy #12

Closed StellarWitch7 closed 2 weeks ago

StellarWitch7 commented 3 weeks ago

Add a glyph that takes a vector and a block type and makes it appear as if there is a block of that type at that position regardless of what is actually there.

Internally references these blocks as shadow blocks, but echo may be more appropriate?

Very WIP, non-functional.

enjarai commented 3 weeks ago

To do:

StellarWitch7 commented 3 weeks ago

Fulfilled TODO 2-3.

StellarWitch7 commented 3 weeks ago

Added Revelation Ploy to dispel shadow blocks programmatically.

StellarWitch7 commented 2 weeks ago

Added Iteration Stratagem glyph, to iterate over a list of values.

StellarWitch7 commented 2 weeks ago

Got Shadow Ploy to work with Sodium and most solid blocks. It appears to have trouble with blocks that have transparency or more complex models, but I've not experimented with it enough to say whether it's an issue with both or only one of those.

StellarWitch7 commented 2 weeks ago

Unfortunately the inject point when Sodium is loaded doesn't have an easy way that I can see to cache the CCA component associated with any chunk, so we're looking up the CCA component every time the block state is fetched through the target method by Sodium's renderer.

Though I'm sure the benefits of Sodium will more than make up for that extra lookup.

StellarWitch7 commented 2 weeks ago

After doing a bit more testing, I've found that the only issue is either making a solid block have a shadow that is not solid, or at a specific Y level, trying to place a shadow block on short grass. If the shadow block type is transparent, it appears to do nothing. If the shadow block is solid, it makes the short grass lose light.

Short grass as sand at the problematic Y level: image

Short grass as oak leaves: image The two oak leaves there are short grass, and the two short grass one block above are also disguised as oak leaves.

Either one block above or one block below and there is no issue. Pumpkins as well as other transparent blocks seem to have issues at that Y level.

There is also sugar cane: image This one only appears to be the blocks that aren't touching the ground which cannot be concealed.

Some of these issues may be Sodium-independent, I haven't checked each one. However I never noticed them before enabling Sodium.

The Y level is 64, standing as a player on a full block. Checked using F3.

For some blocks, nearby block updates--using the same rules as redstone shenanigans--will cause the shadow block to render. This is not the case for short grass. It is the case for chests. For pumpkins, the shadow block can disappear due to block updates.

Sorry for the long comment, just though I'd put this down here in case you decided to mess around with this and I'm not here.

StellarWitch7 commented 2 weeks ago

Shadow blocks now fulfill their name.