Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted bug fixes #814

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
@@ -1,7 +1,30 @@
{
"variants": {
"": {
"facing=down": {
"model": "hexcasting:block/amethyst_sconce",
"x": 180
},
"facing=east": {
"model": "hexcasting:block/amethyst_sconce",
"x": 90,
"y": 90
},
"facing=north": {
"model": "hexcasting:block/amethyst_sconce",
"x": 90
},
"facing=south": {
"model": "hexcasting:block/amethyst_sconce",
"x": 90,
"y": 180
},
"facing=up": {
"model": "hexcasting:block/amethyst_sconce"
},
"facing=west": {
"model": "hexcasting:block/amethyst_sconce",
"x": 90,
"y": 270
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation
import at.petrak.hexcasting.api.casting.iota.Iota

/**
* The result of doing something to a cast harness.
* The result of doing something to a casting VM.
*
* Contains the iota that was executed to produce this CastResult,
* the next thing to execute after this is finished, the modified state of the stack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CastingVM(var image: CastingImage, val env: CastingEnvironment) {
}
}

// Then write all pertinent data back to the harness for the next iteration.
// Then write all pertinent data back to the VM for the next iteration.
if (image2.newData != null) {
this.image = image2.newData
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ data class FrameForEach(
): 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 harness stack...
// init stack to the VM stack...
harness.image.stack.toList()
} else {
// else save the stack to the accumulator and reuse the saved base stack.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package at.petrak.hexcasting.api.casting.eval.vm
import at.petrak.hexcasting.api.casting.iota.Iota

/**
* A change to the data in a CastHarness after a pattern is drawn.
* A change to the data in a CastingVM after a pattern is drawn.
*/
data class FunctionalData(
val stack: List<Iota>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class MishapEvalTooMuch : Mishap() {
}

override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) =
error("eval_too_deep")
error("eval_too_much")
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public InteractionResultHolder<ItemStack> use(Level world, Player player, Intera
}

if (!world.isClientSide() && player instanceof ServerPlayer serverPlayer) {
var harness = IXplatAbstractions.INSTANCE.getStaffcastVM(serverPlayer, hand);
var vm = IXplatAbstractions.INSTANCE.getStaffcastVM(serverPlayer, hand);
var patterns = IXplatAbstractions.INSTANCE.getPatternsSavedInUi(serverPlayer);
var descs = harness.generateDescs();
var descs = vm.generateDescs();

IXplatAbstractions.INSTANCE.sendPacketToPlayer(serverPlayer,
new MsgOpenSpellGuiS2C(hand, patterns, descs.getFirst(), descs.getSecond(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public InteractionResultHolder<ItemStack> use(Level world, Player player, Intera
}
var sPlayer = (ServerPlayer) player;
var ctx = new PackagedItemCastEnv(sPlayer, usedHand);
var harness = CastingVM.empty(ctx);
var clientView = harness.queueExecuteAndWrapIotas(instrs, sPlayer.serverLevel());
var vm = CastingVM.empty(ctx);
var clientView = vm.queueExecuteAndWrapIotas(instrs, sPlayer.serverLevel());

var patterns = instrs.stream()
.filter(i -> i instanceof PatternIota)
Expand Down
Robotgiggle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@
add_segment: "Adding line",
},
cast: {
fail: "Mishap crunches",
normal: "Action hums",
spell: "Spell boinks",
hermes: "Hermes' twangs",
Expand Down Expand Up @@ -927,7 +928,7 @@
wrong_dimension: "cannot see %s from %s",
entity_too_far: "%s is out of range",
immune_entity: "cannot alter %s",
eval_too_deep: "Recursively evaluated too deep",
eval_too_much: "Evaluated too many patterns",
no_item: "needs %s but got nothing",
"no_item.offhand": "needs %s in the other hand but got nothing",
bad_entity: "needs %s but got %s",
Expand Down Expand Up @@ -1383,8 +1384,8 @@
"retrospection.title": "Hasty Retrospection",
retrospection: "I attempted to draw $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Retrospection/$ without first drawing $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)Introspection/$.$(br2)Causes orange sparks, and pushes the pattern for $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Retrospection/$ to the stack as a pattern iota.",

"too_deep.title": "Delve Too Deep",
too_deep: "Evaluated too many spells with meta-evaluation from one spell.$(br2)Causes dark blue sparks, and chokes all the air out of me.",
"too_many_patterns.title": "Lost in Thought",
too_many_patterns: "I attempted to evaluate too many patterns in one _Hex. Often, this happens because I've accidentally created an infinite loop.$(br2)Causes dark blue sparks, and chokes all the air out of me.",

"true_name.title": "Transgress Other",
true_name: "I attempted to $(l:patterns/readwrite#hexcasting:write)$(action)save a reference/$ to another player to a permanent medium.$(br2)Causes black sparks, and robs me of my sight for approximately one minute.",
Expand Down Expand Up @@ -1557,7 +1558,7 @@

spellcircles: {
"1": "I KNOW what the $(l:items/slate)$(item)slates/$ are for. The grand assemblies lost to time. The patterns scribed on them can be actuated in sequence, automatically. Thought and power ricocheting through, one by one by one by one by one by through and through and THROUGH AND -- I must not I must not I should know better than to think that way.",
"2": "To start the ritual I need an $(l:greatwork/impetus)$(item)Impetus/$ to create a self-sustaining wave of _media. That wave travels along a track of $(l:items/slate)$(item)slates/$ or other blocks suitable for the energies, one by one, collecting any patterns it finds. Once the wave circles back around to the $(l:greatwork/impetus)$(item)Impetus/$, all the patterns encountered are cast in order.$(br2)The direction the _media exits any given block MUST be unambiguous, or the casting will fail at the block with too many neighbors.",
"2": "To start the ritual I need an $(l:greatwork/impetus)$(item)Impetus/$ to create a self-sustaining wave of _media. That wave travels along a track of $(l:items/slate)$(item)slates/$ or other suitable blocks, casting any patterns it finds.$(br2)If there is no way for the wave to return to the $(l:greatwork/impetus)$(item)Impetus/$, the casting will fail immediately. Also, the direction the wave exits any given block MUST be unambiguous, or the casting will fail at the block with too many neighbors.",
"3": "As a result, the outline of the spell \"circle\" may be any closed shape, concave or convex, and it may face any direction. In fact, with the application of certain other blocks it is possible to make a spell circle that spans all three dimensions. I doubt such an oddity has very much use, but I must allocate myself a bit of vapid levity to encourage my crude mind to continue my work.",
"4": "Miracle of miracles, the circle will withdraw _media neither from my inventory nor my mind. Instead, crystallized shards of _media must be provided to the $(l:greatwork/impetus)$(item)Impetus/$ via hopper, or other such artifice.$(br2)The application of a $(l:items/lens)$(item)Scrying Lens/$ will show how much _media is inside an $(l:greatwork/impetus)$(item)Impetus/$, in units of dust.",
"5": "However, a spell cast from a circle does have one major limitation: it is unable to affect anything outside of the circle's bounds. That is, it cannot interact with anything outside of the cuboid of minimum size which encloses every block composing it (so a concave spell circle can still affect things in the concavity).",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@
wrong_dimension: "не удается увидеть %s из %s",
entity_too_far: "%s находится вне диапазона",
immune_entity: "невозможно изменить %s",
eval_too_deep: "Рекурсивные вычисления слишком глубокие",
eval_too_much: "Рекурсивные вычисления слишком глубокие",
no_item: "нуждается в %s, но ничего не получает",
"no_item.offhand": "нуждается в %s в другой руке, но ничего не получил",
bad_entity: "нуждается в %s, но получил %s",
Expand Down Expand Up @@ -1294,8 +1294,8 @@
"retrospection.title": "Поспешная Ретроспектива",
retrospection: "Я попытался нарисовать $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Ретроспектива/$ без предварительного рисования $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)Интроспекция/$.$(br2)Вызывает оранжевые искры и помещает шаблон для $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Ретроспектива/$ в стек как шаблон иота.",

"too_deep.title": "Слишком глубоко",
too_deep: "Оценено слишком много заклинаний с метаоценкой от одного заклинания.$(br2)Вызывает темно-синие искры и лишает меня всего воздуха.",
"too_many_patterns.title": "Слишком глубоко",
too_many_patterns: "Оценено слишком много заклинаний с метаоценкой от одного заклинания.$(br2)Вызывает темно-синие искры и лишает меня всего воздуха.",

"true_name.title": "Нарушение Законов",
true_name: "Я попытался $(l:patterns/readwrite#hexcasting:write)$(action)сохранить истинное имя/$ другого игрока на постоянный носитель.$(br2)Вызывает черные искры и лишает меня зрения примерно на одну минуту.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@
wrong_dimension: "无法在%2$s中影响到%1$s",
entity_too_far: "%s超出影响范围",
immune_entity: "无法影响到%s",
eval_too_deep: "递归深度过大",
eval_too_much: "递归深度过大",
no_item: "需要%s,而实际无对应物品",
"no_item.offhand": "需要在另一只手里持有%s,而实际无对应物品",
bad_entity: "需要%s,而实际接受了%s",
Expand Down Expand Up @@ -1381,8 +1381,8 @@
"retrospection.title": "反思过急",
retrospection: "试图在绘制$(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)内省/$前绘制$(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)反思/$。$(br2)产生橙色火花,并压入一个$(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)反思/$对应的图案。",

"too_deep.title": "钻研过深",
too_deep: "在一个法术内以元运行方式运行过多法术。$(br2)产生暗蓝色火花,并使我窒息。",
"too_many_patterns.title": "钻研过深",
too_many_patterns: "在一个法术内以元运行方式运行过多法术。$(br2)产生暗蓝色火花,并使我窒息。",

"true_name.title": "违犯他人",
true_name: "试图在某种永久性媒介中$(l:patterns/readwrite#hexcasting:write)$(action)存储/$代表另一位玩家的 iota。$(br2)产生黑色火花,并致盲大约一分钟。",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
},
{
"type": "patchouli:text",
"title": "hexcasting.page.mishaps.too_deep.title",
"text": "hexcasting.page.mishaps.too_deep"
"title": "hexcasting.page.mishaps.too_many_patterns.title",
"text": "hexcasting.page.mishaps.too_many_patterns"
},
{
"type": "patchouli:text",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"hexcasting:staff/crimson",
"hexcasting:staff/warped",
"hexcasting:staff/mangrove",
"hexcasting:staff/bamboo",
"hexcasting:staff/cherry",
"hexcasting:staff/edified"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.jetbrains.annotations.Nullable;

public class CCStaffcastImage implements Component {
public static final String TAG_HARNESS = "harness";
public static final String TAG_VM = "harness";

private final ServerPlayer owner;
private CompoundTag lazyLoadedTag = new CompoundTag();
Expand Down Expand Up @@ -39,11 +39,11 @@ public void setImage(@Nullable CastingImage image) {

@Override
public void readFromNbt(CompoundTag tag) {
this.lazyLoadedTag = tag.getCompound(TAG_HARNESS);
this.lazyLoadedTag = tag.getCompound(TAG_VM);
}

@Override
public void writeToNbt(CompoundTag tag) {
tag.put(TAG_HARNESS, this.lazyLoadedTag);
tag.put(TAG_VM, this.lazyLoadedTag);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void setSentinel(Player player, @Nullable Sentinel sentinel) {

@Override
public void setStaffcastImage(ServerPlayer player, @Nullable CastingImage image) {
player.getPersistentData().put(TAG_HARNESS, image == null ? new CompoundTag() : image.serializeToNbt());
player.getPersistentData().put(TAG_VM, image == null ? new CompoundTag() : image.serializeToNbt());
}

@Override
Expand Down Expand Up @@ -285,9 +285,9 @@ public Sentinel getSentinel(Player player) {

@Override
public CastingVM getStaffcastVM(ServerPlayer player, InteractionHand hand) {
// This is always from a staff because we don't need to load the harness when casting from item
// This is always from a staff because we don't need to load the VM when casting from item
var ctx = new StaffCastEnv(player, hand);
return new CastingVM(CastingImage.loadFromNbt(player.getPersistentData().getCompound(TAG_HARNESS),
return new CastingVM(CastingImage.loadFromNbt(player.getPersistentData().getCompound(TAG_VM),
player.serverLevel()), ctx);
}

Expand All @@ -305,7 +305,7 @@ public List<ResolvedPattern> getPatternsSavedInUi(ServerPlayer player) {

@Override
public void clearCastingData(ServerPlayer player) {
player.getPersistentData().remove(TAG_HARNESS);
player.getPersistentData().remove(TAG_VM);
player.getPersistentData().remove(TAG_PATTERNS);
}

Expand Down Expand Up @@ -585,6 +585,6 @@ public void setScale(Entity e, float scale) {

public static final UUID ALTIORA_ATTRIBUTE_ID = UUID.fromString("91897c79-3ebb-468c-a265-40418ed01c41");

public static final String TAG_HARNESS = "hexcasting:spell_harness";
public static final String TAG_VM = "hexcasting:spell_harness";
public static final String TAG_PATTERNS = "hexcasting:spell_patterns";
}
Loading