Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
49ef1c2
Stop fake players from bloodcasting
beholderface Feb 8, 2025
fb095f5
Merge branch 'FallingColors:main' into main
beholderface Dec 17, 2025
96f5b69
globals my beloved
Real-Luxof Jan 30, 2026
d25d681
ah right
Real-Luxof Jan 30, 2026
0607981
make the log msg make sense
Real-Luxof Jan 30, 2026
5b3bb0a
re-add the server or client mention
Real-Luxof Jan 30, 2026
0f5d773
Merge branch 'main' of https://github.com/beholderface/HexMod
beholderface Feb 18, 2026
fe48130
deprecate the original matchpattern
beholderface Feb 18, 2026
223f846
address pr comments
beholderface Feb 19, 2026
d2efc75
since
beholderface Feb 20, 2026
bb14c13
Fix Shepherd iota not bool mishap translation key
Mar 11, 2026
557bd10
added option to disable wobblyness of patterns on animated slates
aloaloolaola Mar 27, 2026
2fe4abf
Add optional keybinds for changing spellbook pages
pythonmcpi Apr 12, 2026
dbadca5
Add client config setting to disable scrolling spellbooks and abaci i…
pythonmcpi Apr 12, 2026
ffb8de1
Fix OpCreateFluid's check to return the correct message when position…
pythonmcpi Apr 13, 2026
21c94a3
add TreeList class
s5bug Apr 28, 2026
936f50f
Fix FrameForEach to use TreeList
s5bug Apr 28, 2026
97186dc
add deprecated constructor for FrameForEach compat
s5bug Apr 28, 2026
7e4beb9
add auxilliary constructor for ListIota to accept TreeList
s5bug Apr 28, 2026
39bf888
nit: rename nextAcc to newAcc
s5bug Apr 28, 2026
78edb30
remove useless .toList calls
s5bug Apr 28, 2026
19e353b
doc TreeList
s5bug Apr 28, 2026
248b6d9
rename usages of vector to treeList
s5bug Apr 28, 2026
5322998
clarify fixmes and todos
s5bug Apr 28, 2026
25b7f00
add getter for deprecated mutable accumulator
s5bug Apr 28, 2026
6fc406e
fix: op consumption check should happen in CastingVM instead of Patte…
pythonmcpi Apr 29, 2026
f59b665
TreeList for asymptotically-efficient immutable lists [part 1: Thoth'…
object-Object May 6, 2026
7531d36
Merge branch 'main' into main
Teal-Wolf-25-v2 May 7, 2026
8086ae4
Fix OpCreateFluid's check to return the correct message when position…
Robotgiggle May 8, 2026
ee6b6fb
Fix Shepherd top iota not bool mishap translation key (#1013)
Robotgiggle May 8, 2026
5067fb1
Properly use the global on fabric
Robotgiggle May 8, 2026
ee52501
Remove log clutter on world load (#999)
Robotgiggle May 8, 2026
9490c42
More informative description
Robotgiggle May 8, 2026
aca84ef
Add option to disable wobblyness of patterns on animated slates (#1017)
Robotgiggle May 8, 2026
db47443
fix: op consumption check should happen in CastingVM instead of Patte…
Robotgiggle May 8, 2026
42a795e
Invert delta for page turn keybinds
Robotgiggle May 8, 2026
ead6d25
Fix NullPointerException when draw an invalid pattern
zhichaoxi2006 Feb 25, 2026
b753df3
Fix NullPointerException when draw an invalid pattern (#1006)
Robotgiggle May 9, 2026
d63ada1
Fix scroll invert setting interfering with keybind direction
pythonmcpi May 9, 2026
5bb9e1f
Add keybinds for spellbook control and config to disable in-world scr…
Robotgiggle May 9, 2026
40e824e
Deprecate existing matchPattern method (#1002)
Robotgiggle May 9, 2026
e69afcb
Merge commit '40e824e82' into main-to-next-chunk2
s5bug Jun 10, 2026
2b438c5
remove deprecated overloads from FrameForEach
s5bug Jun 10, 2026
7a41722
remove deprecated matchPattern overload from PatternRegistryManifest
s5bug Jun 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ public ServerPlayer getCaster() {
@Override
protected double getCostModifier(PatternShapeMatch match) {
ResourceLocation loc = actionKey(match);
if (isOfTag(IXplatAbstractions.INSTANCE.getActionRegistry(), loc, HexTags.Actions.CANNOT_MODIFY_COST)) {
if (loc != null && isOfTag(IXplatAbstractions.INSTANCE.getActionRegistry(), loc, HexTags.Actions.CANNOT_MODIFY_COST)) {
return 1.0;
} else {
return this.caster.getAttributeValue(HexAttributes.MEDIA_CONSUMPTION_MODIFIER);
}
return this.caster.getAttributeValue(HexAttributes.MEDIA_CONSUMPTION_MODIFIER);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import at.petrak.hexcasting.api.casting.iota.PatternIota
import at.petrak.hexcasting.api.casting.math.HexDir
import at.petrak.hexcasting.api.casting.math.HexPattern
import at.petrak.hexcasting.api.casting.mishaps.Mishap
import at.petrak.hexcasting.api.casting.mishaps.MishapEvalTooMuch
import at.petrak.hexcasting.api.casting.mishaps.MishapInternalException
import at.petrak.hexcasting.api.casting.mishaps.MishapStackSize
import at.petrak.hexcasting.api.casting.mishaps.MishapTooManyCloseParens
Expand Down Expand Up @@ -69,6 +70,13 @@ class CastingVM(var image: CastingImage, val env: CastingEnvironment) {
resolutionType = ResolvedPatternType.ERRORED,
sound = HexEvalSounds.MISHAP,
)
} else if (result.newData != null && result.newData.opsConsumed > env.maxOpCount()) {
result.copy(
newData = null,
sideEffects = listOf(OperatorSideEffect.DoMishap(MishapEvalTooMuch(), Mishap.Context(null, null))),
resolutionType = ResolvedPatternType.ERRORED,
sound = HexEvalSounds.MISHAP,
)
} else {
result
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType
import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.casting.iota.IotaType
import at.petrak.hexcasting.api.casting.iota.ListIota
import at.petrak.hexcasting.api.utils.TreeList
import at.petrak.hexcasting.common.lib.hex.HexEvalSounds
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
Expand All @@ -29,14 +30,13 @@ data class FrameForEach(
val data: SpellList,
val code: SpellList,
val baseStack: List<Iota>?,
val acc: MutableList<Iota>
val acc: TreeList<Iota>
) : ContinuationFrame {

/** When halting, we add the stack state at halt to the stack accumulator, then return the original pre-Thoth stack, plus the accumulator. */
override fun breakDownwards(stack: List<Iota>): Pair<Boolean, List<Iota>> {
val newStack = baseStack?.toMutableList() ?: mutableListOf()
acc.addAll(stack)
newStack.add(ListIota(acc))
newStack.add(ListIota(acc.appendedAll(stack)))
return true to newStack
}

Expand All @@ -47,21 +47,20 @@ data class FrameForEach(
harness: CastingVM
): CastResult {
// If this isn't the very first Thoth step (i.e. no Thoth computations run yet)...
val stack = if (baseStack == null) {
// init stack to the VM stack...
harness.image.stack.toList()
val (stack, newAcc) = if (baseStack == null) {
// init stack to the harness stack...
harness.image.stack.toList() to acc
} else {
// else save the stack to the accumulator and reuse the saved base stack.
acc.addAll(harness.image.stack)
baseStack
baseStack to acc.appendedAll(harness.image.stack)
}

// If we still have data to process...
val (stackTop, newImage, newCont) = if (data.nonEmpty) {
// push the next datum to the top of the stack,
val cont2 = continuation
// put the next Thoth object back on the stack for the next Thoth cycle,
.pushFrame(FrameForEach(data.cdr, code, stack, acc))
.pushFrame(FrameForEach(data.cdr, code, stack, newAcc))
// and prep the Thoth'd code block for evaluation.
.pushFrame(FrameEvaluate(code, true))
Triple(data.car, harness.image.withUsedOp(), cont2)
Expand Down Expand Up @@ -96,7 +95,7 @@ data class FrameForEach(
IotaType.TYPED_CODEC.listOf().optionalFieldOf("base").forGetter { Optional.ofNullable(it.baseStack) },
IotaType.TYPED_CODEC.listOf().fieldOf("accumulator").forGetter { it.acc }
).apply(inst) { a, b, c, d ->
FrameForEach(a, b, c.getOrNull(), d)
FrameForEach(a, b, c.getOrNull(), TreeList.from(d))
}
}
val STREAM_CODEC = StreamCodec.composite(
Expand All @@ -107,7 +106,7 @@ data class FrameForEach(
IotaType.TYPED_STREAM_CODEC
.apply(ByteBufCodecs.list()), FrameForEach::acc
) { a, b, c, d ->
FrameForEach(a, b, c.getOrNull(), d)
FrameForEach(a, b, c.getOrNull(), TreeList.from(d))
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package at.petrak.hexcasting.api.casting.iota;

import at.petrak.hexcasting.api.casting.SpellList;
import at.petrak.hexcasting.api.utils.TreeList;
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
import com.mojang.serialization.MapCodec;
import net.minecraft.ChatFormatting;
Expand Down Expand Up @@ -35,6 +36,10 @@ public ListIota(@NotNull SpellList list) {
size = totalSize;
}

public ListIota(@NotNull TreeList<Iota> list) {
this(new SpellList.LList(list));
}

public ListIota(@NotNull List<Iota> list) {
this(new SpellList.LList(list));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public boolean toleratesOther(Iota that) {
public @NotNull CastResult execute(CastingVM vm, ServerLevel world, SpellContinuation continuation) {
Supplier<@Nullable Component> castedName = () -> null;
try {
var lookup = PatternRegistryManifest.matchPattern(this.getPattern(), vm.getEnv(), false);
var lookup = PatternRegistryManifest.matchPattern(this.getPattern(), vm.getEnv());
vm.getEnv().precheckAction(lookup);

Action action;
Expand Down Expand Up @@ -102,10 +102,6 @@ public boolean toleratesOther(Iota that) {
continuation
);

if (result.getNewImage().getOpsConsumed() > vm.getEnv().maxOpCount()) {
throw new MishapEvalTooMuch();
}

var cont2 = result.getNewContinuation();
// TODO parens also break prescience
var sideEffects = result.getSideEffects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ class MishapBoolDirectrixNotBool(
}

override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component =
error("circle.bool_directrix_no_bool", pos.toShortString(), perpetrator.display())
error("circle.bool_directrix.no_bool", pos.toShortString(), perpetrator.display())
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public interface CommonConfigAccess {
public interface ClientConfigAccess {
boolean ctrlTogglesOffStrokeOrder();

boolean disableInworldScrolling();

boolean invertSpellbookScrollDirection();

boolean invertAbacusScrollDirection();
Expand All @@ -49,11 +51,15 @@ public interface ClientConfigAccess {

boolean clickingTogglesDrawing();

boolean staticActiveSlates();

boolean DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER = false;
boolean DEFAULT_DISABLE_INWORLD_SCROLLING = false;
boolean DEFAULT_INVERT_SPELLBOOK_SCROLL = false;
boolean DEFAULT_INVERT_ABACUS_SCROLL = false;
double DEFAULT_GRID_SNAP_THRESHOLD = 0.5;
boolean DEFAULT_CLICKING_TOGGLES_DRAWING = false;
boolean DEFAULT_STATIC_ACTIVE_SLATES = false;
}

public interface ServerConfigAccess {
Expand Down
Loading
Loading