Revert "go absolutely ham impling list utils"

This reverts commit 45fc0aae66.
This commit is contained in:
Noobulus 2022-02-02 12:47:40 -06:00
parent 45fc0aae66
commit 62870e3642
7 changed files with 14 additions and 81 deletions

View file

@ -5,13 +5,22 @@ import at.petrak.hexcasting.api.Operator;
import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.SpellDatum;
import at.petrak.hexcasting.common.casting.operators.*;
import at.petrak.hexcasting.common.casting.operators.eval.*;
import at.petrak.hexcasting.common.casting.operators.lists.*;
import at.petrak.hexcasting.common.casting.operators.eval.OpEvalDelay;
import at.petrak.hexcasting.common.casting.operators.eval.OpForEach;
import at.petrak.hexcasting.common.casting.operators.lists.OpAppend;
import at.petrak.hexcasting.common.casting.operators.lists.OpConcat;
import at.petrak.hexcasting.common.casting.operators.lists.OpIndex;
import at.petrak.hexcasting.common.casting.operators.math.*;
import at.petrak.hexcasting.common.casting.operators.selectors.*;
import at.petrak.hexcasting.common.casting.operators.selectors.OpGetCaster;
import at.petrak.hexcasting.common.casting.operators.selectors.OpGetEntitiesBy;
import at.petrak.hexcasting.common.casting.operators.selectors.OpGetEntityAt;
import at.petrak.hexcasting.common.casting.operators.spells.*;
import at.petrak.hexcasting.common.casting.operators.spells.great.*;
import at.petrak.hexcasting.common.casting.operators.spells.sentinel.*;
import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpCreateSentinel;
import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpDestroySentinel;
import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentinelPos;
import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentinelWayfind;
import at.petrak.hexcasting.common.casting.operators.eval.*;
import at.petrak.hexcasting.common.items.magic.ItemArtifact;
import at.petrak.hexcasting.common.items.magic.ItemCypher;
import at.petrak.hexcasting.common.items.magic.ItemTrinket;
@ -22,8 +31,6 @@ import net.minecraft.world.phys.Vec3;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import java.util.regex.Pattern;
import static at.petrak.hexcasting.common.lib.RegisterHelper.prefix;
public class RegisterPatterns {
@ -286,12 +293,6 @@ public class RegisterPatterns {
OpIndex.INSTANCE);
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("dadad", HexDir.NORTH_EAST), prefix("for_each"),
OpForEach.INSTANCE);
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("aqaeaq", HexDir.EAST), prefix("list_size"),
OpListSize.INSTANCE);
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("adeeed", HexDir.EAST), prefix("singleton"),
OpSingleton.INSTANCE);
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("qqaeaae", HexDir.NORTH_EAST), prefix("empty_list"),
OpEmptyList.INSTANCE);
} catch (PatternRegistry.RegisterPatternException exn) {
exn.printStackTrace();

View file

@ -1,13 +0,0 @@
package at.petrak.hexcasting.common.casting.operators.lists
import at.petrak.hexcasting.api.ConstManaOperator
import at.petrak.hexcasting.api.Operator.Companion.spellListOf
import at.petrak.hexcasting.api.SpellDatum
import at.petrak.hexcasting.common.casting.CastingContext
object OpEmptyList : ConstManaOperator {
override val argc = 0
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): List<SpellDatum<*>> {
return spellListOf(emptyList<SpellDatum<*>>()) // sorry for taking all the easy impls, hudeler
}
}

View file

@ -1,15 +0,0 @@
package at.petrak.hexcasting.common.casting.operators.lists
import at.petrak.hexcasting.api.ConstManaOperator
import at.petrak.hexcasting.api.Operator.Companion.getChecked
import at.petrak.hexcasting.api.Operator.Companion.spellListOf
import at.petrak.hexcasting.api.SpellDatum
import at.petrak.hexcasting.common.casting.CastingContext
// it's still called beancounter's distillation in my heart
object OpListSize : ConstManaOperator {
override val argc = 1
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): List<SpellDatum<*>> {
return spellListOf(args.getChecked<List<SpellDatum<*>>>(0).toList().size.toDouble()) // mmm one-liner
}
}

View file

@ -1,13 +0,0 @@
package at.petrak.hexcasting.common.casting.operators.lists
import at.petrak.hexcasting.api.ConstManaOperator
import at.petrak.hexcasting.api.Operator.Companion.spellListOf
import at.petrak.hexcasting.api.SpellDatum
import at.petrak.hexcasting.common.casting.CastingContext
object OpSingleton : ConstManaOperator {
override val argc = 1
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): List<SpellDatum<*>> {
return spellListOf(listOf(args[0])) // god i love one-liners
}
}

View file

@ -20,7 +20,7 @@ class OpWeather(val rain: Boolean) : SpellOperator {
override fun cast(ctx: CastingContext) {
val w = ctx.world
if (w.isRaining != rain) {
w.levelData.isRaining = rain // i hex the rains down in minecraftia
w.levelData.isRaining = rain // i bless the rains down in minecraftia
}
}
}

View file

@ -80,9 +80,6 @@
"hexcasting.spell.hexcasting:concat": "Combination Distillation",
"hexcasting.spell.hexcasting:index": "Selection Distillation",
"hexcasting.spell.hexcasting:for_each": "Thoth's Gambit",
"hexcasting.spell.hexcasting:list_size": "Numerologist's Purification",
"hexcasting.spell.hexcasting:singleton": "Single's Purification",
"hexcasting.spell.hexcasting:empty_list": "Vacant Reflection",
"hexcasting.spell.hexcasting:get_entity": "Entity Purification",
"hexcasting.spell.hexcasting:get_entity/animal": "Entity Prfn.: Animal",
"hexcasting.spell.hexcasting:get_entity/monster": "Entity Prfn.: Monster",

View file

@ -29,30 +29,6 @@
"input": "list, list",
"output": "list",
"text": "Remove the list at the top of the stack, then add all its elements to the end of the list at the top of the stack."
},
{
"type": "hexcasting:pattern",
"op_id": "hexcasting:empty_list",
"anchor": "hexcasting:empty_list",
"input": "",
"output": "list",
"text": "Push an empty list to the top of the stack."
},
{
"type": "hexcasting:pattern",
"op_id": "hexcasting:singleton",
"anchor": "hexcasting:singleton",
"input": "any",
"output": "list",
"text": "Remove the top of the stack, then push a list containing only that element."
},
{
"type": "hexcasting:pattern",
"op_id": "hexcasting:list_size",
"anchor": "hexcasting:list_size",
"input": "list",
"output": "num",
"text": "Remove the list at the top of the stack, then push the number of elements in the list to the stack."
}
]
}