port lookup to java
This commit is contained in:
parent
1424cff844
commit
5a8f8317c9
15 changed files with 432 additions and 404 deletions
|
@ -0,0 +1,243 @@
|
|||
package at.petrak.hexcasting.api;
|
||||
|
||||
import at.petrak.hexcasting.api.spell.Action;
|
||||
import at.petrak.hexcasting.api.spell.math.EulerPathFinder;
|
||||
import at.petrak.hexcasting.api.spell.math.HexDir;
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern;
|
||||
import at.petrak.hexcasting.api.spell.mishaps.MishapInvalidPattern;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.saveddata.SavedData;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
public class PatternRegistry {
|
||||
private static final ConcurrentMap<ResourceLocation, Action> actionLookup = new ConcurrentHashMap<>();
|
||||
private static final ConcurrentLinkedDeque<SpecialHandlerEntry> specialHandlers = new ConcurrentLinkedDeque<>();
|
||||
|
||||
// Map signatures to the "preferred" direction they start in and their operator ID.
|
||||
private static final ConcurrentMap<String, RegularEntry> regularPatternLookup =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
private static final ConcurrentMap<ResourceLocation, PerWorldEntry> perWorldPatternLookup =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
public static void mapPattern(HexPattern pattern, ResourceLocation id,
|
||||
Action action) throws RegisterPatternException {
|
||||
mapPattern(pattern, id, action, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a given angle signature with a SpellOperator.
|
||||
*/
|
||||
public static void mapPattern(HexPattern pattern, ResourceLocation id, Action action,
|
||||
boolean isPerWorld) throws RegisterPatternException {
|
||||
if (actionLookup.containsKey(id)) {
|
||||
throw new RegisterPatternException("The operator with id `%s` was already registered to: %s", id,
|
||||
actionLookup.get(id));
|
||||
}
|
||||
|
||||
actionLookup.put(id, action);
|
||||
if (isPerWorld) {
|
||||
perWorldPatternLookup.put(id, new PerWorldEntry(pattern, id));
|
||||
} else {
|
||||
regularPatternLookup.put(pattern.anglesSignature(), new RegularEntry(pattern.getStartDir(), id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a special handler, to take an arbitrary pattern and return whatever kind of operator you like.
|
||||
*/
|
||||
public static void addSpecialHandler(SpecialHandlerEntry handler) {
|
||||
specialHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a special handler, to take an arbitrary pattern and return whatever kind of operator you like.
|
||||
*/
|
||||
public static void addSpecialHandler(ResourceLocation id, SpecialHandler handler) {
|
||||
addSpecialHandler(new SpecialHandlerEntry(id, handler));
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
public static Action matchPattern(HexPattern pat, ServerLevel overworld) throws MishapInvalidPattern {
|
||||
return matchPatternAndID(pat, overworld).getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
public static Pair<Action, ResourceLocation> matchPatternAndID(HexPattern pat,
|
||||
ServerLevel overworld) throws MishapInvalidPattern {
|
||||
// Pipeline:
|
||||
// patterns are registered here every time the game boots
|
||||
// when we try to look
|
||||
for (var handler : specialHandlers) {
|
||||
var op = handler.handler.handlePattern(pat);
|
||||
if (op != null) {
|
||||
return new Pair<>(op, handler.id);
|
||||
}
|
||||
}
|
||||
|
||||
// Is it global?
|
||||
var sig = pat.anglesSignature();
|
||||
if (regularPatternLookup.containsKey(sig)) {
|
||||
var it = regularPatternLookup.get(sig);
|
||||
if (!actionLookup.containsKey(it.opId)) {
|
||||
throw new MishapInvalidPattern();
|
||||
}
|
||||
var op = actionLookup.get(it.opId);
|
||||
return new Pair<>(op, it.opId);
|
||||
}
|
||||
|
||||
// Look it up in the world?
|
||||
var ds = overworld.getDataStorage();
|
||||
Save perWorldPatterns =
|
||||
ds.computeIfAbsent(Save::load, () -> Save.create(overworld.getSeed()), TAG_SAVED_DATA);
|
||||
if (perWorldPatterns.lookup.containsKey(sig)) {
|
||||
var it = perWorldPatterns.lookup.get(sig);
|
||||
return new Pair<>(actionLookup.get(it.getFirst()), it.getFirst());
|
||||
}
|
||||
|
||||
throw new MishapInvalidPattern();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
public static Map<String, Pair<ResourceLocation, HexDir>> getPerWorldPatterns(ServerLevel overworld) {
|
||||
var ds = overworld.getDataStorage();
|
||||
Save perWorldPatterns =
|
||||
ds.computeIfAbsent(Save::load, () -> Save.create(overworld.getSeed()), TAG_SAVED_DATA);
|
||||
return perWorldPatterns.lookup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
public static PatternEntry lookupPattern(ResourceLocation opId) {
|
||||
if (perWorldPatternLookup.containsKey(opId)) {
|
||||
var it = perWorldPatternLookup.get(opId);
|
||||
return new PatternEntry(it.prototype, actionLookup.get(it.opId), true);
|
||||
}
|
||||
for (var kv : regularPatternLookup.entrySet()) {
|
||||
var sig = kv.getKey();
|
||||
var entry = kv.getValue();
|
||||
if (entry.opId.equals(opId)) {
|
||||
var pattern = HexPattern.fromAngles(sig, entry.preferredStart);
|
||||
return new PatternEntry(pattern, actionLookup.get(entry.opId), false);
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("could not find a pattern for " + opId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
public static Set<ResourceLocation> getAllPerWorldPatternNames() {
|
||||
return perWorldPatternLookup.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Special handling of a pattern. Before checking any of the normal angle-signature based patterns,
|
||||
* a given pattern is run by all of these special handlers patterns. If none of them return non-null,
|
||||
* then its signature is checked.
|
||||
* <p>
|
||||
* In the base mod, this is used for number patterns and Bookkeeper's Gambit.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
interface SpecialHandler {
|
||||
@Nullable Action handlePattern(HexPattern pattern);
|
||||
}
|
||||
|
||||
public record SpecialHandlerEntry(ResourceLocation id, SpecialHandler handler) {
|
||||
}
|
||||
|
||||
public static class RegisterPatternException extends Exception {
|
||||
public RegisterPatternException(String msg, Object... formats) {
|
||||
super(String.format(msg, formats));
|
||||
}
|
||||
}
|
||||
|
||||
private record RegularEntry(HexDir preferredStart, ResourceLocation opId) {
|
||||
}
|
||||
|
||||
private record PerWorldEntry(HexPattern prototype, ResourceLocation opId) {
|
||||
}
|
||||
|
||||
// Fake class we pretend to use internally
|
||||
public record PatternEntry(HexPattern prototype, Action action, boolean isPerWorld) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps angle sigs to resource locations and their preferred start dir so we can look them up in the main registry
|
||||
*/
|
||||
public static class Save extends SavedData {
|
||||
private static final String TAG_OP_ID = "op_id";
|
||||
private static final String TAG_START_DIR = "start_dir";
|
||||
|
||||
// TODO: this is slightly weird that we save it *on* the world
|
||||
// might it be better to recalculate it every time the world loads?
|
||||
private Map<String, Pair<ResourceLocation, HexDir>> lookup;
|
||||
|
||||
public Save(
|
||||
Map<String, Pair<ResourceLocation, HexDir>> lookup) {
|
||||
this.lookup = lookup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag tag) {
|
||||
this.lookup.forEach((sig, rhs) -> {
|
||||
var entry = new CompoundTag();
|
||||
entry.putString(TAG_OP_ID, sig.toString());
|
||||
entry.putInt(TAG_START_DIR, rhs.getSecond().ordinal());
|
||||
tag.put(sig, entry);
|
||||
});
|
||||
return tag;
|
||||
}
|
||||
|
||||
static Save load(CompoundTag tag) {
|
||||
var map = new HashMap<String, Pair<ResourceLocation, HexDir>>();
|
||||
for (var sig : tag.getAllKeys()) {
|
||||
var entry = tag.getCompound(sig);
|
||||
var opId = ResourceLocation.tryParse(entry.getString(TAG_OP_ID));
|
||||
var startDir = HexDir.values()[entry.getInt(TAG_START_DIR)];
|
||||
map.put(sig, new Pair<>(opId, startDir));
|
||||
}
|
||||
return new Save(map);
|
||||
}
|
||||
|
||||
public static Save create(long seed) {
|
||||
var map = new HashMap<String, Pair<ResourceLocation, HexDir>>();
|
||||
PatternRegistry.perWorldPatternLookup.forEach((opId, entry) -> {
|
||||
var scrungled = EulerPathFinder.findAltDrawing(entry.prototype, seed);
|
||||
map.put(scrungled.anglesSignature(), new Pair<>(opId, scrungled.getStartDir()));
|
||||
});
|
||||
var save = new Save(map);
|
||||
save.setDirty();
|
||||
return save;
|
||||
}
|
||||
}
|
||||
|
||||
public static final String TAG_SAVED_DATA = "hex.per-world-patterns";
|
||||
|
||||
public static String getPatternCountInfo() {
|
||||
return String.format(
|
||||
"Loaded %d regular patterns, " +
|
||||
"%d per-world patterns, and " +
|
||||
"%d special handlers.", regularPatternLookup.size(), perWorldPatternLookup.size(),
|
||||
specialHandlers.size());
|
||||
}
|
||||
}
|
|
@ -1,219 +0,0 @@
|
|||
package at.petrak.hexcasting.api
|
||||
|
||||
import at.petrak.hexcasting.api.spell.Action
|
||||
import at.petrak.hexcasting.api.spell.math.EulerPathFinder
|
||||
import at.petrak.hexcasting.api.spell.math.HexDir
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern
|
||||
import at.petrak.hexcasting.api.spell.mishaps.MishapInvalidPattern
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.world.level.saveddata.SavedData
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.ConcurrentLinkedDeque
|
||||
import java.util.concurrent.ConcurrentMap
|
||||
|
||||
/**
|
||||
* Register your patterns and associate them with spells here.
|
||||
*
|
||||
* Most patterns are matches to their operators solely by their *angle signature*.
|
||||
* This is a record of all the angles in the pattern, independent of the direction the player started drawing in.
|
||||
* It's written in shorthand, where `w` is straight ahead, `q` is left, `a` is left-back, `d` is right-back,
|
||||
* and `e` is right.
|
||||
*
|
||||
* For example, the signature for a straight line of 3 segments is `"ww"`. The signatures for the "get caster"
|
||||
* operator (the diamond) are `"qaq"` and `"ede"`.
|
||||
*/
|
||||
object PatternRegistry {
|
||||
private val actionLookup = ConcurrentHashMap<ResourceLocation, Action>()
|
||||
private val specialHandlers: ConcurrentLinkedDeque<SpecialHandlerEntry> = ConcurrentLinkedDeque()
|
||||
|
||||
// Map signatures to the "preferred" direction they start in and their operator ID.
|
||||
private val regularPatternLookup: ConcurrentMap<String, RegularEntry> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
private val perWorldPatternLookup: ConcurrentMap<ResourceLocation, PerWorldEntry> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
/**
|
||||
* Associate a given angle signature with a SpellOperator.
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
@Throws(RegisterPatternException::class)
|
||||
fun mapPattern(pattern: HexPattern, id: ResourceLocation, action: Action, isPerWorld: Boolean = false) {
|
||||
this.actionLookup[id]?.let {
|
||||
throw RegisterPatternException("The operator with id `$id` was already registered to: $it")
|
||||
}
|
||||
|
||||
this.actionLookup[id] = action
|
||||
if (isPerWorld) {
|
||||
this.perWorldPatternLookup[id] = PerWorldEntry(pattern, id)
|
||||
} else {
|
||||
this.regularPatternLookup[pattern.anglesSignature()] = RegularEntry(pattern.startDir, id)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a special handler, to take an arbitrary pattern and return whatever kind of operator you like.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun addSpecialHandler(handler: SpecialHandlerEntry) {
|
||||
this.specialHandlers.add(handler)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun addSpecialHandler(id: ResourceLocation, handler: SpecialHandler) {
|
||||
this.addSpecialHandler(SpecialHandlerEntry(id, handler))
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun matchPattern(pat: HexPattern, overworld: ServerLevel): Action =
|
||||
matchPatternAndID(pat, overworld).first
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun matchPatternAndID(pat: HexPattern, overworld: ServerLevel): Pair<Action, ResourceLocation> {
|
||||
// Pipeline:
|
||||
// patterns are registered here every time the game boots
|
||||
// when we try to look
|
||||
for (handler in specialHandlers) {
|
||||
val op = handler.handler.handlePattern(pat)
|
||||
if (op != null) return op to handler.id
|
||||
}
|
||||
|
||||
// Is it global?
|
||||
val sig = pat.anglesSignature()
|
||||
this.regularPatternLookup[sig]?.let {
|
||||
val op = this.actionLookup[it.opId] ?: throw MishapInvalidPattern()
|
||||
return op to it.opId
|
||||
}
|
||||
|
||||
// Look it up in the world?
|
||||
val ds = overworld.dataStorage
|
||||
val perWorldPatterns: Save =
|
||||
ds.computeIfAbsent(Save.Companion::load, { Save.create(overworld.seed) }, TAG_SAVED_DATA)
|
||||
perWorldPatterns.lookup[sig]?.let {
|
||||
val op = this.actionLookup[it.first]!!
|
||||
return op to it.first
|
||||
}
|
||||
|
||||
throw MishapInvalidPattern()
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getPerWorldPatterns(overworld: ServerLevel): Map<String, Pair<ResourceLocation, HexDir>> {
|
||||
val ds = overworld.dataStorage
|
||||
val perWorldPatterns: Save =
|
||||
ds.computeIfAbsent(Save.Companion::load, { Save.create(overworld.seed) }, TAG_SAVED_DATA)
|
||||
return perWorldPatterns.lookup
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun lookupPattern(opId: ResourceLocation): PatternEntry {
|
||||
this.perWorldPatternLookup[opId]?.let {
|
||||
return PatternEntry(it.prototype, this.actionLookup[it.opId]!!, true)
|
||||
}
|
||||
for ((sig, entry) in this.regularPatternLookup) {
|
||||
if (entry.opId == opId) {
|
||||
val pattern = HexPattern.fromAngles(sig, entry.preferredStart)
|
||||
return PatternEntry(pattern, this.actionLookup[entry.opId]!!, false)
|
||||
}
|
||||
}
|
||||
|
||||
throw IllegalArgumentException("could not find a pattern for $opId")
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getAllPerWorldPatternNames(): Set<ResourceLocation> {
|
||||
return this.perWorldPatternLookup.keys.toSet()
|
||||
}
|
||||
|
||||
/**
|
||||
* Special handling of a pattern. Before checking any of the normal angle-signature based patterns,
|
||||
* a given pattern is run by all of these special handlers patterns. If none of them return non-null,
|
||||
* then its signature is checked.
|
||||
*
|
||||
* In the base mod, this is used for number patterns.
|
||||
*/
|
||||
fun interface SpecialHandler {
|
||||
fun handlePattern(pattern: HexPattern): Action?
|
||||
}
|
||||
|
||||
data class SpecialHandlerEntry(val id: ResourceLocation, val handler: SpecialHandler)
|
||||
|
||||
class RegisterPatternException(msg: String) : Exception(msg)
|
||||
|
||||
private data class RegularEntry(val preferredStart: HexDir, val opId: ResourceLocation)
|
||||
private data class PerWorldEntry(val prototype: HexPattern, val opId: ResourceLocation)
|
||||
|
||||
// Fake class we pretend to use internally
|
||||
data class PatternEntry(val prototype: HexPattern, val action: Action, val isPerWorld: Boolean)
|
||||
|
||||
/**
|
||||
* Maps angle sigs to resource locations and their preferred start dir so we can look them up in the main registry
|
||||
*/
|
||||
class Save(val lookup: MutableMap<String, Pair<ResourceLocation, HexDir>>) : SavedData() {
|
||||
override fun save(tag: CompoundTag): CompoundTag {
|
||||
for ((sig, rhs) in this.lookup) {
|
||||
val (id, startDir) = rhs
|
||||
val entry = CompoundTag()
|
||||
entry.putString(TAG_OP_ID, id.toString())
|
||||
entry.putInt(TAG_START_DIR, startDir.ordinal)
|
||||
tag.put(sig, entry)
|
||||
}
|
||||
return tag
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun load(tag: CompoundTag): Save {
|
||||
val map = HashMap<String, Pair<ResourceLocation, HexDir>>()
|
||||
for (sig in tag.allKeys) {
|
||||
val entry = tag.getCompound(sig)
|
||||
val opId = ResourceLocation.tryParse(entry.getString(TAG_OP_ID))!!
|
||||
val startDir = HexDir.values()[entry.getInt(TAG_START_DIR)]
|
||||
map[sig] = opId to startDir
|
||||
}
|
||||
return Save(map)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun create(seed: Long): Save {
|
||||
val map = mutableMapOf<String, Pair<ResourceLocation, HexDir>>()
|
||||
for ((opId, entry) in PatternRegistry.perWorldPatternLookup) {
|
||||
// waugh why doesn't kotlin recursively destructure things
|
||||
val scrungled = EulerPathFinder.findAltDrawing(entry.prototype, seed)
|
||||
map[scrungled.anglesSignature()] = opId to scrungled.startDir
|
||||
}
|
||||
val save = Save(map)
|
||||
save.setDirty()
|
||||
return save
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const val TAG_SAVED_DATA = "hex.per-world-patterns"
|
||||
private const val TAG_OP_ID = "op_id"
|
||||
private const val TAG_START_DIR = "start_dir"
|
||||
|
||||
@JvmStatic
|
||||
fun getPatternCountInfo(): String = "Loaded ${regularPatternLookup.size} regular patterns, " +
|
||||
"${perWorldPatternLookup.size} per-world patterns, and " +
|
||||
"${specialHandlers.size} special handlers."
|
||||
}
|
|
@ -152,7 +152,9 @@ class CastingHarness private constructor(
|
|||
var actionIdPair: Pair<Action, ResourceLocation>? = null
|
||||
try {
|
||||
// Don't catch this one
|
||||
actionIdPair = PatternRegistry.matchPatternAndID(newPat, world)
|
||||
val mojangPair = PatternRegistry.matchPatternAndID(newPat, world)
|
||||
actionIdPair = mojangPair.first to mojangPair.second
|
||||
|
||||
if (this.ctx.spellCircle == null && !HexConfig.server().isActionAllowed(actionIdPair.second)) {
|
||||
throw MishapDisallowedSpell()
|
||||
} else if (this.ctx.spellCircle != null
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.common.casting;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.misc.ManaConstants;
|
||||
import at.petrak.hexcasting.api.spell.Action;
|
||||
import at.petrak.hexcasting.api.spell.iota.DoubleIota;
|
||||
|
@ -52,267 +52,267 @@ public class RegisterPatterns {
|
|||
// - CW is the special or destruction version
|
||||
// == Getters ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qaq", HexDir.NORTH_EAST), modLoc("get_caster"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaq", HexDir.NORTH_EAST), modLoc("get_caster"),
|
||||
OpGetCaster.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aa", HexDir.EAST), modLoc("get_entity_pos"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aa", HexDir.EAST), modLoc("get_entity_pos"),
|
||||
OpEntityPos.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wa", HexDir.EAST), modLoc("get_entity_look"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wa", HexDir.EAST), modLoc("get_entity_look"),
|
||||
OpEntityLook.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("awq", HexDir.NORTH_EAST), modLoc("get_entity_height"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awq", HexDir.NORTH_EAST), modLoc("get_entity_height"),
|
||||
OpEntityHeight.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wq", HexDir.EAST), modLoc("get_entity_velocity"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wq", HexDir.EAST), modLoc("get_entity_velocity"),
|
||||
OpEntityVelocity.INSTANCE);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaawdd", HexDir.EAST), modLoc("raycast"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaawdd", HexDir.EAST), modLoc("raycast"),
|
||||
OpBlockRaycast.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("weddwaa", HexDir.EAST), modLoc("raycast/axis"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("weddwaa", HexDir.EAST), modLoc("raycast/axis"),
|
||||
OpBlockAxisRaycast.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("weaqa", HexDir.EAST), modLoc("raycast/entity"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("weaqa", HexDir.EAST), modLoc("raycast/entity"),
|
||||
OpEntityRaycast.INSTANCE);
|
||||
|
||||
// == spell circle getters ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqae", HexDir.SOUTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqwqae", HexDir.SOUTH_WEST),
|
||||
modLoc("circle/impetus_pos"), OpImpetusPos.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST),
|
||||
modLoc("circle/impetus_dir"), OpImpetusDir.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqaewdd", HexDir.SOUTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqwqaewdd", HexDir.SOUTH_WEST),
|
||||
modLoc("circle/bounds/min"), new OpCircleBounds(false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST),
|
||||
modLoc("circle/bounds/max"), new OpCircleBounds(true));
|
||||
|
||||
// == Modify Stack ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aadaa", HexDir.EAST), modLoc("duplicate"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aadaa", HexDir.EAST), modLoc("duplicate"),
|
||||
OpDuplicate.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aadaadaa", HexDir.EAST), modLoc("duplicate_n"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aadaadaa", HexDir.EAST), modLoc("duplicate_n"),
|
||||
OpDuplicateN.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qwaeawqaeaqa", HexDir.NORTH_WEST), modLoc("stack_len"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qwaeawqaeaqa", HexDir.NORTH_WEST), modLoc("stack_len"),
|
||||
OpStackSize.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aawdd", HexDir.EAST), modLoc("swap"), OpSwap.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ddad", HexDir.WEST), modLoc("fisherman"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawdd", HexDir.EAST), modLoc("swap"), OpSwap.INSTANCE);
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddad", HexDir.WEST), modLoc("fisherman"),
|
||||
OpFisherman.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST), modLoc("swizzle"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST), modLoc("swizzle"),
|
||||
OpAlwinfyHasAscendedToABeingOfPureMath.INSTANCE);
|
||||
|
||||
// == Math ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waaw", HexDir.NORTH_EAST), modLoc("add"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waaw", HexDir.NORTH_EAST), modLoc("add"),
|
||||
OpAdd.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wddw", HexDir.NORTH_WEST), modLoc("sub"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wddw", HexDir.NORTH_WEST), modLoc("sub"),
|
||||
OpSub.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waqaw", HexDir.SOUTH_EAST), modLoc("mul_dot"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waqaw", HexDir.SOUTH_EAST), modLoc("mul_dot"),
|
||||
OpMulDot.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST), modLoc("div_cross"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST), modLoc("div_cross"),
|
||||
OpDivCross.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqw", HexDir.NORTH_EAST), modLoc("abs_len"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaqw", HexDir.NORTH_EAST), modLoc("abs_len"),
|
||||
OpAbsLen.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wedew", HexDir.NORTH_WEST), modLoc("pow_proj"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wedew", HexDir.NORTH_WEST), modLoc("pow_proj"),
|
||||
OpPowProj.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ewq", HexDir.EAST), modLoc("floor"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ewq", HexDir.EAST), modLoc("floor"),
|
||||
OpFloor.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qwe", HexDir.EAST), modLoc("ceil"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qwe", HexDir.EAST), modLoc("ceil"),
|
||||
OpCeil.INSTANCE);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eqqqqq", HexDir.EAST), modLoc("construct_vec"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqqqq", HexDir.EAST), modLoc("construct_vec"),
|
||||
OpConstructVec.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qeeeee", HexDir.EAST), modLoc("deconstruct_vec"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qeeeee", HexDir.EAST), modLoc("deconstruct_vec"),
|
||||
OpDeconstructVec.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaww", HexDir.NORTH_WEST), modLoc("coerce_axial"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaww", HexDir.NORTH_WEST), modLoc("coerce_axial"),
|
||||
OpCoerceToAxial.INSTANCE);
|
||||
|
||||
// == Logic ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wdw", HexDir.NORTH_EAST), modLoc("and"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdw", HexDir.NORTH_EAST), modLoc("and"),
|
||||
OpBoolAnd.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waw", HexDir.SOUTH_EAST), modLoc("or"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waw", HexDir.SOUTH_EAST), modLoc("or"),
|
||||
OpBoolOr.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("dwa", HexDir.NORTH_WEST), modLoc("xor"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dwa", HexDir.NORTH_WEST), modLoc("xor"),
|
||||
OpBoolXor.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("e", HexDir.SOUTH_EAST), modLoc("greater"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("e", HexDir.SOUTH_EAST), modLoc("greater"),
|
||||
new OpCompare(false, (a, b) -> a > b));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("q", HexDir.SOUTH_WEST), modLoc("less"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("q", HexDir.SOUTH_WEST), modLoc("less"),
|
||||
new OpCompare(false, (a, b) -> a < b));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ee", HexDir.SOUTH_EAST), modLoc("greater_eq"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ee", HexDir.SOUTH_EAST), modLoc("greater_eq"),
|
||||
new OpCompare(true, (a, b) -> a >= b));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qq", HexDir.SOUTH_WEST), modLoc("less_eq"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qq", HexDir.SOUTH_WEST), modLoc("less_eq"),
|
||||
new OpCompare(true, (a, b) -> a <= b));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ad", HexDir.EAST), modLoc("equals"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ad", HexDir.EAST), modLoc("equals"),
|
||||
new OpEquality(false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("da", HexDir.EAST), modLoc("not_equals"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("da", HexDir.EAST), modLoc("not_equals"),
|
||||
new OpEquality(true));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), modLoc("not"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), modLoc("not"),
|
||||
OpBoolNot.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), modLoc("identity"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), modLoc("identity"),
|
||||
OpBoolIdentityKindOf.INSTANCE);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST), modLoc("random"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST), modLoc("random"),
|
||||
OpRandom.INSTANCE);
|
||||
|
||||
// == Advanced Math ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST), modLoc("sin"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST), modLoc("sin"),
|
||||
OpSin.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST), modLoc("cos"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST), modLoc("cos"),
|
||||
OpCos.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST), modLoc("tan"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST), modLoc("tan"),
|
||||
OpTan.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST), modLoc("arcsin"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST), modLoc("arcsin"),
|
||||
OpArcSin.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST), modLoc("arccos"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST), modLoc("arccos"),
|
||||
OpArcCos.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST), modLoc("arctan"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST), modLoc("arctan"),
|
||||
OpArcTan.INSTANCE);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST), modLoc("logarithm"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST), modLoc("logarithm"),
|
||||
OpLog.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST), modLoc("modulo"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST), modLoc("modulo"),
|
||||
OpModulo.INSTANCE);
|
||||
|
||||
// == Sets ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wdweaqa", HexDir.NORTH_EAST), modLoc("and_bit"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdweaqa", HexDir.NORTH_EAST), modLoc("and_bit"),
|
||||
OpAnd.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST), modLoc("or_bit"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST), modLoc("or_bit"),
|
||||
OpOr.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("dwaeaqa", HexDir.NORTH_WEST), modLoc("xor_bit"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dwaeaqa", HexDir.NORTH_WEST), modLoc("xor_bit"),
|
||||
OpXor.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST), modLoc("not_bit"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST), modLoc("not_bit"),
|
||||
OpNot.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aweaqa", HexDir.NORTH_EAST), modLoc("to_set"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aweaqa", HexDir.NORTH_EAST), modLoc("to_set"),
|
||||
OpToSet.INSTANCE);
|
||||
|
||||
// == Spells ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("de", HexDir.NORTH_EAST), modLoc("print"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("de", HexDir.NORTH_EAST), modLoc("print"),
|
||||
OpPrint.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aawaawaa", HexDir.EAST), modLoc("explode"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawaawaa", HexDir.EAST), modLoc("explode"),
|
||||
new OpExplode(false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ddwddwdd", HexDir.EAST), modLoc("explode/fire"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddwddwdd", HexDir.EAST), modLoc("explode/fire"),
|
||||
new OpExplode(true));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST), modLoc("add_motion"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST), modLoc("add_motion"),
|
||||
OpAddMotion.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST), modLoc("blink"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST), modLoc("blink"),
|
||||
OpBlink.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qaqqqqq", HexDir.EAST), modLoc("break_block"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaqqqqq", HexDir.EAST), modLoc("break_block"),
|
||||
OpBreakBlock.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeede", HexDir.SOUTH_WEST), modLoc("place_block"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeede", HexDir.SOUTH_WEST), modLoc("place_block"),
|
||||
OpPlaceBlock.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST),
|
||||
modLoc("colorize"),
|
||||
OpColorize.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST), modLoc("create_water"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST), modLoc("create_water"),
|
||||
OpCreateWater.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST),
|
||||
modLoc("destroy_water"),
|
||||
OpDestroyWater.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), modLoc("ignite"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), modLoc("ignite"),
|
||||
OpIgnite.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), modLoc("extinguish"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), modLoc("extinguish"),
|
||||
OpExtinguish.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqa", HexDir.NORTH_EAST), modLoc("conjure_block"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqa", HexDir.NORTH_EAST), modLoc("conjure_block"),
|
||||
new OpConjureBlock(false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqd", HexDir.NORTH_EAST), modLoc("conjure_light"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqd", HexDir.NORTH_EAST), modLoc("conjure_light"),
|
||||
new OpConjureBlock(true));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST), modLoc("bonemeal"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST), modLoc("bonemeal"),
|
||||
OpTheOnlyReasonAnyoneDownloadedPsi.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST),
|
||||
modLoc("recharge"),
|
||||
OpRecharge.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"),
|
||||
new OpErase());
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"),
|
||||
OpEdifySapling.INSTANCE);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("adaa", HexDir.WEST), modLoc("beep"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adaa", HexDir.WEST), modLoc("beep"),
|
||||
OpBeep.INSTANCE);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waqqqqq", HexDir.EAST), modLoc("craft/cypher"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waqqqqq", HexDir.EAST), modLoc("craft/cypher"),
|
||||
new OpMakePackagedSpell<>(HexItems.CYPHER, ManaConstants.CRYSTAL_UNIT));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST),
|
||||
modLoc("craft/trinket"),
|
||||
new OpMakePackagedSpell<>(HexItems.TRINKET, 5 * ManaConstants.CRYSTAL_UNIT));
|
||||
PatternRegistry.mapPattern(
|
||||
PatternRegistryBak.mapPattern(
|
||||
HexPattern.fromAngles("wwaqqqqqeawqwqwqwqwqwwqqeadaeqqeqqeadaeqq", HexDir.EAST),
|
||||
modLoc("craft/artifact"),
|
||||
new OpMakePackagedSpell<>(HexItems.ARTIFACT, 10 * ManaConstants.CRYSTAL_UNIT));
|
||||
PatternRegistry.mapPattern(
|
||||
PatternRegistryBak.mapPattern(
|
||||
HexPattern.fromAngles("aqqqaqwwaqqqqqeqaqqqawwqwqwqwqwqw", HexDir.SOUTH_WEST),
|
||||
modLoc("craft/battery"),
|
||||
OpMakeBattery.INSTANCE,
|
||||
true);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST),
|
||||
modLoc("potion/weakness"),
|
||||
new OpPotionEffect(MobEffects.WEAKNESS, ManaConstants.DUST_UNIT / 10, true, false, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqawwawawd", HexDir.WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqawwawawd", HexDir.WEST),
|
||||
modLoc("potion/levitation"),
|
||||
new OpPotionEffect(MobEffects.LEVITATION, ManaConstants.DUST_UNIT / 5, false, false, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaewawawe", HexDir.SOUTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaewawawe", HexDir.SOUTH_WEST),
|
||||
modLoc("potion/wither"),
|
||||
new OpPotionEffect(MobEffects.WITHER, ManaConstants.DUST_UNIT, true, false, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqadwawaww", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqadwawaww", HexDir.SOUTH_EAST),
|
||||
modLoc("potion/poison"),
|
||||
new OpPotionEffect(MobEffects.POISON, ManaConstants.DUST_UNIT / 3, true, false, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqadwawaw", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqadwawaw", HexDir.SOUTH_EAST),
|
||||
modLoc("potion/slowness"),
|
||||
new OpPotionEffect(MobEffects.MOVEMENT_SLOWDOWN, ManaConstants.DUST_UNIT / 3, true, false, false));
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqaawawaedd", HexDir.NORTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqaawawaedd", HexDir.NORTH_WEST),
|
||||
modLoc("potion/regeneration"),
|
||||
new OpPotionEffect(MobEffects.REGENERATION, ManaConstants.DUST_UNIT, true, true, true), true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqaawawaeqdd", HexDir.WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqaawawaeqdd", HexDir.WEST),
|
||||
modLoc("potion/night_vision"),
|
||||
new OpPotionEffect(MobEffects.NIGHT_VISION, ManaConstants.DUST_UNIT / 5, false, true, true), true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqaawawaeqqdd", HexDir.SOUTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqaawawaeqqdd", HexDir.SOUTH_WEST),
|
||||
modLoc("potion/absorption"),
|
||||
new OpPotionEffect(MobEffects.ABSORPTION, ManaConstants.DUST_UNIT, true, true, true), true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qaawawaeqqqdd", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaawawaeqqqdd", HexDir.SOUTH_EAST),
|
||||
modLoc("potion/haste"),
|
||||
new OpPotionEffect(MobEffects.DIG_SPEED, ManaConstants.DUST_UNIT / 3, true, true, true), true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aawawaeqqqqdd", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawawaeqqqqdd", HexDir.EAST),
|
||||
modLoc("potion/strength"),
|
||||
new OpPotionEffect(MobEffects.DAMAGE_BOOST, ManaConstants.DUST_UNIT / 3, true, true, true), true);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waeawae", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawae", HexDir.EAST),
|
||||
modLoc("sentinel/create"),
|
||||
new OpCreateSentinel(false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST),
|
||||
modLoc("sentinel/destroy"),
|
||||
OpDestroySentinel.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaede", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaede", HexDir.EAST),
|
||||
modLoc("sentinel/get_pos"),
|
||||
OpGetSentinelPos.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaedwa", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaedwa", HexDir.EAST),
|
||||
modLoc("sentinel/wayfind"),
|
||||
OpGetSentinelWayfind.INSTANCE);
|
||||
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST),
|
||||
modLoc("lightning"), OpLightning.INSTANCE, true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST),
|
||||
modLoc("flight"), OpFlight.INSTANCE, true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST),
|
||||
modLoc("create_lava"), OpCreateLava.INSTANCE, true);
|
||||
PatternRegistry.mapPattern(
|
||||
PatternRegistryBak.mapPattern(
|
||||
HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", HexDir.EAST),
|
||||
modLoc("teleport"), OpTeleport.INSTANCE, true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST),
|
||||
modLoc("sentinel/create/great"),
|
||||
new OpCreateSentinel(true), true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST),
|
||||
modLoc("dispel_rain"),
|
||||
new OpWeather(false), true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST),
|
||||
modLoc("summon_rain"),
|
||||
new OpWeather(true), true);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST),
|
||||
modLoc("brainsweep"),
|
||||
OpBrainsweep.INSTANCE, true);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqwqqqqqaq", HexDir.WEST), modLoc("akashic/read"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqwqqqqqaq", HexDir.WEST), modLoc("akashic/read"),
|
||||
OpAkashicRead.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeweeeeede", HexDir.EAST), modLoc("akashic/write"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeweeeeede", HexDir.EAST), modLoc("akashic/write"),
|
||||
OpAkashicWrite.INSTANCE);
|
||||
|
||||
// == Meta stuff ==
|
||||
|
@ -322,154 +322,155 @@ public class RegisterPatterns {
|
|||
|
||||
// http://www.toroidalsnark.net/mkss3-pix/CalderheadJMM2014.pdf
|
||||
// eval being a space filling curve feels apt doesn't it
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), modLoc("eval"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), modLoc("eval"),
|
||||
OpEval.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"),
|
||||
OpHalt.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"),
|
||||
OpRead.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"),
|
||||
OpWrite.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"),
|
||||
OpReadable.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"),
|
||||
OpWritable.INSTANCE);
|
||||
|
||||
// lorge boyes
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST),
|
||||
modLoc("read/entity"), OpTheCoolerRead.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST),
|
||||
modLoc("readable/entity"), OpTheCoolerReadable.INSTANCE);
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qeewdweddw", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qeewdweddw", HexDir.NORTH_EAST),
|
||||
modLoc("read/local"), OpPeekLocal.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST),
|
||||
modLoc("write/local"), OpPushLocal.INSTANCE);
|
||||
|
||||
// == Consts ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("d", HexDir.EAST), modLoc("const/null"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("d", HexDir.EAST), modLoc("const/null"),
|
||||
Action.makeConstantOp(new NullIota()));
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqea", HexDir.NORTH_WEST), modLoc("const/vec/px"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqea", HexDir.NORTH_WEST), modLoc("const/vec/px"),
|
||||
Action.makeConstantOp(new Vec3Iota(new Vec3(1.0, 0.0, 0.0))));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqew", HexDir.NORTH_WEST), modLoc("const/vec/py"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqew", HexDir.NORTH_WEST), modLoc("const/vec/py"),
|
||||
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 1.0, 0.0))));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqed", HexDir.NORTH_WEST), modLoc("const/vec/pz"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqed", HexDir.NORTH_WEST), modLoc("const/vec/pz"),
|
||||
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 1.0))));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqa", HexDir.SOUTH_WEST), modLoc("const/vec/nx"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeeqa", HexDir.SOUTH_WEST), modLoc("const/vec/nx"),
|
||||
Action.makeConstantOp(new Vec3Iota(new Vec3(-1.0, 0.0, 0.0))));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqw", HexDir.SOUTH_WEST), modLoc("const/vec/ny"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeeqw", HexDir.SOUTH_WEST), modLoc("const/vec/ny"),
|
||||
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, -1.0, 0.0))));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqd", HexDir.SOUTH_WEST), modLoc("const/vec/nz"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeeqd", HexDir.SOUTH_WEST), modLoc("const/vec/nz"),
|
||||
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, -1.0))));
|
||||
// Yep, this is what I spend the "plain hexagon" pattern on.
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqq", HexDir.NORTH_WEST), modLoc("const/vec/0"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqq", HexDir.NORTH_WEST), modLoc("const/vec/0"),
|
||||
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 0.0))));
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qdwdq", HexDir.NORTH_EAST), modLoc("const/double/pi"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qdwdq", HexDir.NORTH_EAST), modLoc("const/double/pi"),
|
||||
Action.makeConstantOp(new DoubleIota(Math.PI)));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eawae", HexDir.NORTH_WEST), modLoc("const/double/tau"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eawae", HexDir.NORTH_WEST), modLoc("const/double/tau"),
|
||||
Action.makeConstantOp(new DoubleIota(HexUtils.TAU)));
|
||||
|
||||
// e
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aaq", HexDir.EAST), modLoc("const/double/e"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aaq", HexDir.EAST), modLoc("const/double/e"),
|
||||
Action.makeConstantOp(new DoubleIota(Math.E)));
|
||||
|
||||
// == Entities ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqa", HexDir.SOUTH_EAST), modLoc("get_entity"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqa", HexDir.SOUTH_EAST), modLoc("get_entity"),
|
||||
new OpGetEntityAt(e -> true));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST),
|
||||
modLoc("get_entity/animal"),
|
||||
new OpGetEntityAt(OpGetEntitiesBy::isAnimal));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST),
|
||||
modLoc("get_entity/monster"),
|
||||
new OpGetEntityAt(OpGetEntitiesBy::isMonster));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST),
|
||||
modLoc("get_entity/item"),
|
||||
new OpGetEntityAt(OpGetEntitiesBy::isItem));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST),
|
||||
modLoc("get_entity/player"),
|
||||
new OpGetEntityAt(OpGetEntitiesBy::isPlayer));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST),
|
||||
modLoc("get_entity/living"),
|
||||
new OpGetEntityAt(OpGetEntitiesBy::isLiving));
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwded", HexDir.SOUTH_EAST), modLoc("zone_entity"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwded", HexDir.SOUTH_EAST), modLoc("zone_entity"),
|
||||
new OpGetEntitiesBy(e -> true, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST),
|
||||
modLoc("zone_entity/animal"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawa", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaawa", HexDir.NORTH_EAST),
|
||||
modLoc("zone_entity/not_animal"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, true));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwq", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwq", HexDir.SOUTH_EAST),
|
||||
modLoc("zone_entity/monster"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawq", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaawq", HexDir.NORTH_EAST),
|
||||
modLoc("zone_entity/not_monster"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, true));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddww", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddww", HexDir.SOUTH_EAST),
|
||||
modLoc("zone_entity/item"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isItem, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaaww", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaaww", HexDir.NORTH_EAST),
|
||||
modLoc("zone_entity/not_item"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isItem, true));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwe", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwe", HexDir.SOUTH_EAST),
|
||||
modLoc("zone_entity/player"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawe", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaawe", HexDir.NORTH_EAST),
|
||||
modLoc("zone_entity/not_player"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, true));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwd", HexDir.SOUTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwd", HexDir.SOUTH_EAST),
|
||||
modLoc("zone_entity/living"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, false));
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawd", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaawd", HexDir.NORTH_EAST),
|
||||
modLoc("zone_entity/not_living"),
|
||||
new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, true));
|
||||
|
||||
// == Lists ==
|
||||
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"),
|
||||
OpAppend.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"),
|
||||
OpConcat.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"),
|
||||
OpIndex.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("dadad", HexDir.NORTH_EAST), modLoc("for_each"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dadad", HexDir.NORTH_EAST), modLoc("for_each"),
|
||||
OpForEach.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"),
|
||||
OpListSize.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"),
|
||||
OpSingleton.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqaeaae", HexDir.NORTH_EAST), modLoc("empty_list"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqaeaae", HexDir.NORTH_EAST), modLoc("empty_list"),
|
||||
OpEmptyList.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"),
|
||||
OpReverski.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ewdqdwe", HexDir.SOUTH_WEST), modLoc("last_n_list"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ewdqdwe", HexDir.SOUTH_WEST), modLoc("last_n_list"),
|
||||
OpLastNToList.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"),
|
||||
OpSplat.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"),
|
||||
OpIndexOf.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST), modLoc("list_remove"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST), modLoc("list_remove"),
|
||||
OpRemove.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"),
|
||||
OpSlice.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST), modLoc("modify_in_place"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST),
|
||||
modLoc("modify_in_place"),
|
||||
OpModifyInPlace.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"),
|
||||
OpCons.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"),
|
||||
OpUnCons.INSTANCE);
|
||||
|
||||
} catch (PatternRegistry.RegisterPatternException exn) {
|
||||
} catch (PatternRegistryBak.RegisterPatternException exn) {
|
||||
exn.printStackTrace();
|
||||
}
|
||||
|
||||
// Add zilde->number
|
||||
PatternRegistry.addSpecialHandler(modLoc("number"), pat -> {
|
||||
PatternRegistryBak.addSpecialHandler(modLoc("number"), pat -> {
|
||||
var sig = pat.anglesSignature();
|
||||
if (sig.startsWith("aqaa") || sig.startsWith("dedd")) {
|
||||
var negate = sig.startsWith("dedd");
|
||||
|
@ -496,7 +497,7 @@ public class RegisterPatterns {
|
|||
}
|
||||
});
|
||||
|
||||
PatternRegistry.addSpecialHandler(modLoc("mask"), pat -> {
|
||||
PatternRegistryBak.addSpecialHandler(modLoc("mask"), pat -> {
|
||||
var directions = pat.directions();
|
||||
|
||||
HexDir flatDir = pat.getStartDir();
|
||||
|
|
|
@ -80,8 +80,8 @@ public class ListPatternsCommand {
|
|||
var lookup = PatternRegistry.getPerWorldPatterns(ctx.getSource().getLevel());
|
||||
|
||||
lookup.forEach((pattern, entry) -> {
|
||||
var opId = entry.component1();
|
||||
var startDir = entry.component2();
|
||||
var opId = entry.getFirst();
|
||||
var startDir = entry.getSecond();
|
||||
|
||||
var tag = new CompoundTag();
|
||||
tag.putString(ItemScroll.TAG_OP_ID, opId.toString());
|
||||
|
|
|
@ -27,7 +27,8 @@ public class PatternResLocArgument extends ResourceLocationArgument {
|
|||
|
||||
@Override
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||
return SharedSuggestionProvider.suggest(PatternRegistry.getAllPerWorldPatternNames().stream().map(Object::toString), builder);
|
||||
return SharedSuggestionProvider.suggest(
|
||||
PatternRegistry.getAllPerWorldPatternNames().stream().map(Object::toString), builder);
|
||||
}
|
||||
|
||||
public static HexPattern getPattern(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.common.command;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
@ -13,7 +13,7 @@ public class RecalcPatternsCommand {
|
|||
.executes(ctx -> {
|
||||
var world = ctx.getSource().getServer().overworld();
|
||||
var ds = world.getDataStorage();
|
||||
ds.set(PatternRegistry.TAG_SAVED_DATA, PatternRegistry.Save.create(world.getSeed()));
|
||||
ds.set(PatternRegistryBak.TAG_SAVED_DATA, PatternRegistryBak.Save.create(world.getSeed()));
|
||||
|
||||
ctx.getSource().sendSuccess(
|
||||
new TranslatableComponent("command.hexcasting.recalc"), true);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.common.loot;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern;
|
||||
import at.petrak.hexcasting.common.items.ItemScroll;
|
||||
import at.petrak.hexcasting.common.lib.HexLootFunctions;
|
||||
|
@ -22,7 +22,7 @@ public class PatternScrollFunc extends LootItemConditionalFunction {
|
|||
@Override
|
||||
protected ItemStack run(ItemStack stack, LootContext ctx) {
|
||||
var rand = ctx.getRandom();
|
||||
var worldLookup = PatternRegistry.getPerWorldPatterns(ctx.getLevel());
|
||||
var worldLookup = PatternRegistryBak.getPerWorldPatterns(ctx.getLevel());
|
||||
|
||||
var keys = worldLookup.keySet().stream().toList();
|
||||
var sig = keys.get(rand.nextInt(keys.size()));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.interop.patchouli;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.spell.math.HexCoord;
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
@ -23,7 +23,7 @@ public class LookupPatternComponent extends AbstractPatternComponent {
|
|||
|
||||
@Override
|
||||
public List<Pair<HexPattern, HexCoord>> getPatterns(UnaryOperator<IVariable> lookup) {
|
||||
var entry = PatternRegistry.lookupPattern(this.opName);
|
||||
var entry = PatternRegistryBak.lookupPattern(this.opName);
|
||||
this.strokeOrder = !entry.isPerWorld();
|
||||
return List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin()));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.interop.pehkui;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.spell.math.HexDir;
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
@ -10,11 +10,11 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
|
|||
public class PehkuiInterop {
|
||||
public static void init() {
|
||||
try {
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST),
|
||||
modLoc("interop/pehkui/get"), OpGetScale.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("ddwdwwdwwd", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddwdwwdwwd", HexDir.NORTH_EAST),
|
||||
modLoc("interop/pehkui/set"), OpSetScale.INSTANCE);
|
||||
} catch (PatternRegistry.RegisterPatternException e) {
|
||||
} catch (PatternRegistryBak.RegisterPatternException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.fabric.interop.emi;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.spell.math.HexCoord;
|
||||
import at.petrak.hexcasting.interop.utils.PatternDrawingUtil;
|
||||
import at.petrak.hexcasting.interop.utils.PatternEntry;
|
||||
|
@ -25,7 +25,7 @@ public class PatternRendererEMI implements EmiRenderable {
|
|||
private final List<Vec2> pathfinderDots;
|
||||
|
||||
public PatternRendererEMI(ResourceLocation pattern, int w, int h) {
|
||||
var entry = PatternRegistry.lookupPattern(pattern);
|
||||
var entry = PatternRegistryBak.lookupPattern(pattern);
|
||||
this.strokeOrder = !entry.isPerWorld();
|
||||
var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin())));
|
||||
this.patterns = data.patterns();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.fabric.interop.gravity;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.spell.math.HexDir;
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern;
|
||||
|
||||
|
@ -9,11 +9,11 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
|
|||
public class GravityApiInterop {
|
||||
public static void init() {
|
||||
try {
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST),
|
||||
modLoc("interop/gravity/get"), OpGetGravity.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.fromAngles("wdwdwaaqw", HexDir.NORTH_WEST),
|
||||
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdwdwaaqw", HexDir.NORTH_WEST),
|
||||
modLoc("interop/gravity/set"), OpChangeGravity.INSTANCE);
|
||||
} catch (PatternRegistry.RegisterPatternException e) {
|
||||
} catch (PatternRegistryBak.RegisterPatternException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.fabric.interop.rei;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.spell.math.HexCoord;
|
||||
import at.petrak.hexcasting.interop.utils.PatternDrawingUtil;
|
||||
import at.petrak.hexcasting.interop.utils.PatternEntry;
|
||||
|
@ -28,7 +28,7 @@ public class PatternRendererREI implements Renderer {
|
|||
private final List<Vec2> pathfinderDots;
|
||||
|
||||
public PatternRendererREI(ResourceLocation pattern, int w, int h) {
|
||||
var entry = PatternRegistry.lookupPattern(pattern);
|
||||
var entry = PatternRegistryBak.lookupPattern(pattern);
|
||||
this.strokeOrder = !entry.isPerWorld();
|
||||
var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin())));
|
||||
this.patterns = data.patterns();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.forge;
|
||||
|
||||
import at.petrak.hexcasting.api.HexAPI;
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers;
|
||||
import at.petrak.hexcasting.api.mod.HexConfig;
|
||||
import at.petrak.hexcasting.api.mod.HexStatistics;
|
||||
|
@ -147,7 +147,7 @@ public class ForgeHexInitializer {
|
|||
});
|
||||
|
||||
modBus.addListener((FMLLoadCompleteEvent evt) ->
|
||||
HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo()));
|
||||
HexAPI.LOGGER.info(PatternRegistryBak.getPatternCountInfo()));
|
||||
|
||||
evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> {
|
||||
var res = Brainsweeping.tradeWithVillager(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.forge.interop.jei;
|
||||
|
||||
import at.petrak.hexcasting.api.PatternRegistry;
|
||||
import at.petrak.hexcasting.api.PatternRegistryBak;
|
||||
import at.petrak.hexcasting.api.spell.math.HexCoord;
|
||||
import at.petrak.hexcasting.interop.utils.PatternDrawingUtil;
|
||||
import at.petrak.hexcasting.interop.utils.PatternEntry;
|
||||
|
@ -25,7 +25,7 @@ public class PatternDrawable implements IDrawable {
|
|||
private final List<Vec2> pathfinderDots;
|
||||
|
||||
public PatternDrawable(ResourceLocation pattern, int w, int h) {
|
||||
var entry = PatternRegistry.lookupPattern(pattern);
|
||||
var entry = PatternRegistryBak.lookupPattern(pattern);
|
||||
this.strokeOrder = !entry.isPerWorld();
|
||||
var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin())));
|
||||
this.patterns = data.patterns();
|
||||
|
|
Loading…
Reference in a new issue