diff --git a/CHANGELOG.md b/CHANGELOG.md index 042a990080..47c79c6bf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Added a config toggle (default false) for the effect that makes iota-holding items display their entire NBT data when Advanced Tooltips is enabled ([#1021](https://github.com/FallingColors/HexMod/pull/1021)) @Robotgiggle - Added a pattern display overlay for pattern-holding items (ie scrolls or slates) while holding shift in the inventory ([#879](https://github.com/FallingColors/HexMod/pull/879)) @SamsTheNerd - Added connected textures for Akashic Ligatures when using Continuity or Optifine ([#885](https://github.com/FallingColors/HexMod/pull/885)) @kineticneticat -- Added Similarity Distillation and Dissimilarity Distillation for comparing iota types ([#1114](https://github.com/FallingColors/HexMod/pull/1114)) @IridescentVoid +- Added type comparison patterns ([#1114](https://github.com/FallingColors/HexMod/pull/1114)) @IridescentVoid + - Similarity Distillation and Dissimilarity Distillation for iota types + - Surveyor's Distillation and Inspector's Distillation for blocks + - Taxonomer's Distillation for entities + - Sorter's Distillation and Stacking Distillation for items - Added Contemplation for escaping without the exponential growth of Consideration ([#1102](https://github.com/FallingColors/HexMod/pull/1102)) @IridescentVoid ### Changed diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpBlockEquality.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpBlockEquality.kt new file mode 100644 index 0000000000..2e8cd090df --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpBlockEquality.kt @@ -0,0 +1,24 @@ +package at.petrak.hexcasting.common.casting.actions.types + +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment +import at.petrak.hexcasting.api.casting.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota + +class OpBlockEquality(val exact: Boolean) : ConstMediaAction { + override val argc = 2 + + override fun execute(args: List, env: CastingEnvironment): List { + val posA = args.getBlockPos(0).also { env.assertPosInRange(it) } + val posB = args.getBlockPos(1).also { env.assertPosInRange(it) } + + val blockA = env.world.getBlockState(posA) + val blockB = env.world.getBlockState(posB) + + // a unique BlockState only has one instance + val matches = if (exact) blockA === blockB else blockA.`is`(blockB.block) + + return matches.asActionResult + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpEntityEquality.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpEntityEquality.kt new file mode 100644 index 0000000000..6668f4cdd4 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpEntityEquality.kt @@ -0,0 +1,18 @@ +package at.petrak.hexcasting.common.casting.actions.types + +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment +import at.petrak.hexcasting.api.casting.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota + +object OpEntityEquality : ConstMediaAction { + override val argc = 2 + + override fun execute(args: List, env: CastingEnvironment): List { + val entityA = args.getEntity(0).also { env.assertEntityInRange(it) } + val entityB = args.getEntity(1).also { env.assertEntityInRange(it) } + + return (entityA.type == entityB.type).asActionResult + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpItemEquality.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpItemEquality.kt new file mode 100644 index 0000000000..20d557d950 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpItemEquality.kt @@ -0,0 +1,29 @@ +package at.petrak.hexcasting.common.casting.actions.types + +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment +import at.petrak.hexcasting.api.casting.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapInvalidIota +import at.petrak.hexcasting.common.lib.HexItemHolderHandlers +import net.minecraft.world.item.ItemStack + +class OpItemEquality(val exact: Boolean) : ConstMediaAction { + override val argc = 2 + + override fun execute(args: List, env: CastingEnvironment): List { + val itemA = args.getEntity(0).also { env.assertEntityInRange(it) } + .let { HexItemHolderHandlers.applyHandlerFor(it) } + ?: throw MishapInvalidIota.ofType(args[0], 0, "entity.item_holder") + + val itemB = args.getEntity(1).also { env.assertEntityInRange(it) } + .let { HexItemHolderHandlers.applyHandlerFor(it) } + ?: throw MishapInvalidIota.ofType(args[1], 1, "entity.item_holder") + + val matches = if (exact) ItemStack.isSameItemSameTags(itemA, itemB) + else ItemStack.isSameItem(itemA, itemB) + + return matches.asActionResult + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/math/logic/OpTypeEquality.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpTypeEquality.kt similarity index 89% rename from Common/src/main/java/at/petrak/hexcasting/common/casting/actions/math/logic/OpTypeEquality.kt rename to Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpTypeEquality.kt index cd31212ca0..9effc144c9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/math/logic/OpTypeEquality.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/types/OpTypeEquality.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.common.casting.actions.math.logic +package at.petrak.hexcasting.common.casting.actions.types import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.castables.ConstMediaAction diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItemHolderHandlers.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItemHolderHandlers.java new file mode 100644 index 0000000000..006f68ca7a --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItemHolderHandlers.java @@ -0,0 +1,47 @@ +package at.petrak.hexcasting.common.lib; + +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.decoration.ItemFrame; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +public class HexItemHolderHandlers { + private static Map, Function> REGISTRY = new HashMap<>(); + + /** + * Register a handler for mapping an entity type to an item. + * + * @param type Type of entity to register the handler for. + * @param handler The handler function. May return null, in which case dependent patterns will mishap. + */ + public static void register(EntityType type, Function handler) { + REGISTRY.put(type, handler); + } + + @SuppressWarnings("unchecked") + public static @Nullable ItemStack applyHandlerFor(Entity e) { + var handler = REGISTRY.getOrDefault(e.getType(), entity -> null); + ItemStack stack = ((Function) handler).apply(e); + + if (stack != null && stack.isEmpty()) stack = null; + + return stack; + } + + public static void init() { + register(EntityType.ITEM, ItemEntity::getItem); + register(EntityType.ITEM_FRAME, ItemFrame::getItem); + register(EntityType.PLAYER, player -> { + ItemStack mainHand = player.getItemInHand(InteractionHand.MAIN_HAND); + if (!mainHand.isEmpty()) return mainHand; + return player.getItemInHand(InteractionHand.OFF_HAND); + }); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java index 23103fac87..dfdb73fa32 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java @@ -29,7 +29,10 @@ import at.petrak.hexcasting.common.casting.actions.math.logic.OpBoolIf; import at.petrak.hexcasting.common.casting.actions.math.logic.OpCoerceToBool; import at.petrak.hexcasting.common.casting.actions.math.logic.OpEquality; -import at.petrak.hexcasting.common.casting.actions.math.logic.OpTypeEquality; +import at.petrak.hexcasting.common.casting.actions.types.OpEntityEquality; +import at.petrak.hexcasting.common.casting.actions.types.OpItemEquality; +import at.petrak.hexcasting.common.casting.actions.types.OpTypeEquality; +import at.petrak.hexcasting.common.casting.actions.types.OpBlockEquality; import at.petrak.hexcasting.common.casting.actions.queryentity.*; import at.petrak.hexcasting.common.casting.actions.raycast.OpBlockAxisRaycast; import at.petrak.hexcasting.common.casting.actions.raycast.OpBlockRaycast; @@ -543,6 +546,23 @@ public class HexActions { true) )); + // == Types == + public static final ActionRegistryEntry COMPARE_BLOCK = make("compare_block/lenient", new ActionRegistryEntry( + HexPattern.fromAngles("qqqqqeqeeeee", HexDir.NORTH_WEST), new OpBlockEquality(false) + )); + public static final ActionRegistryEntry COMPARE_BLOCK_STRICT = make("compare_block/strict", new ActionRegistryEntry( + HexPattern.fromAngles("qwawqwadadwewdwe", HexDir.NORTH_WEST), new OpBlockEquality(true) + )); + public static final ActionRegistryEntry COMPARE_ENTITY = make("compare_entity", new ActionRegistryEntry( + HexPattern.fromAngles("aqaeqded", HexDir.NORTH_WEST), OpEntityEquality.INSTANCE + )); + public static final ActionRegistryEntry COMPARE_ITEM = make("compare_item/lenient", new ActionRegistryEntry( + HexPattern.fromAngles("qaeaqeqedqde", HexDir.NORTH_WEST), new OpItemEquality(false) + )); + public static final ActionRegistryEntry COMPARE_ITEM_STRICT = make("compare_item/strict", new ActionRegistryEntry( + HexPattern.fromAngles("qaeaqewqedqde", HexDir.NORTH_WEST), new OpItemEquality(true) + )); + // == Lists == public static final ActionRegistryEntry APPEND = make("append", diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 index c138b18e6d..6d16f63261 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 @@ -789,6 +789,18 @@ not_player: "Zone Distillation: Non-Player", not_living: "Zone Distillation: Non-Living", }, + + type_equals: "Similarity Distillation", + type_not_equals: "Dissimilarity Distillation", + "compare_block/": { + "lenient": "Surveyor's Distillation", + "strict": "Inspector's Distillation", + }, + compare_entity: "Taxonomer's Distillation", + "compare_item/": { + "lenient": "Sorter's Distillation", + "strict": "Stacking Distillation", + }, swap: "Jester's Gambit", rotate: "Rotation Gambit", @@ -814,8 +826,6 @@ less_eq: "Minimus Distillation II", equals: "Equality Distillation", not_equals: "Inequality Distillation", - type_equals: "Similarity Distillation", - type_not_equals: "Dissimilarity Distillation", not: "Negation Purification", bool_coerce: "Augur's Purification", if: "Augur's Exaltation", @@ -1106,6 +1116,7 @@ "": "an entity", mob: "a mob", item: "an item entity", + item_holder: "an item-holding entity", player: "a player", living: "a living entity", }, @@ -1311,6 +1322,7 @@ stackmanip: "Stack Manipulation", logic: "Logical Operators", entities: "Entities", + types: "Types", lists: "List Manipulation", patterns_as_iotas: "Escaping Patterns", readwrite: "Reading and Writing", @@ -1909,8 +1921,6 @@ if: "If the first argument is True, keeps the second and discards the third; otherwise discards the second and keeps the third.", equals: "If the first argument equals the second (within a small tolerance), return True. Otherwise, return False.", not_equals: "If the first argument does not equal the second (outside a small tolerance), return True. Otherwise, return False.", - type_equals: "If the type of the first argument matches the type of the second, return True. Otherwise, return False.", - type_not_equals: "If the type of the first argument does not match the type of the second, return True. Otherwise, return False.", greater: "If the first argument is greater than the second, return True. Otherwise, return False.", less: "If the first argument is less than the second, return True. Otherwise, return False.", greater_eq: "If the first argument is greater than or equal to the second, return True. Otherwise, return False.", @@ -1941,6 +1951,23 @@ not_living: "Take a position and maximum distance on the stack, and combine them into a list of non-living entities near the position.", }, }, + + types: { + type_equals: "Compare the given iotas and push whether they are of the same type.", + type_not_equals: "Compare the given iotas and push whether they are of different types.", + "compare_block/": { + lenient: "Compare the blocks specified by the given vectors and push whether they are of the same type. Two $(l:items/edified#hexcasting:cut_edified_plank_variants)$(item)Edified Stairs/$ will always compare as equal regardless of their shape or if they are waterlogged.", + strict: "Compare the blocks specified by the given vectors and push whether they appear to be identical. Two placed $(l:items/edified#hexcasting:cut_edified_plank_variants)$(item)Edified Stairs/$ will only compare as equal if they appear exactly the same.", + remarks: "Nature seems a bit arbitrary as to when blocks appear identical to each other. Placed $(l:items/slate)$(item)Slates/$ appear identical if they face the same direction and share waterlogging state, even if they have different patterns written to them. Similarly, chests appear identical if their outward appearance is the same, even if their contents differ." + }, + compare_entity: "Compare the given entities and push whether they are of the same type.", + "compare_item/": { + lenient: "Compare the items represented or held by the given entities and push whether they are the same type of item. Two $(l:items/focus)$(item)Foci/$ will always compare as equal.", + strict: "Like $(l:patterns/types#hexcasting:compare_item/lenient)$(action)Sorter's Distillation/$, but push whether they are identical items. Two $(l:items/focus)$(item)Foci/$ only compare as identical if they hold the same iota and have $(l:patterns/spells/cyclevariant)$(thing)the same appearance/$.", + "remarks.title": "On Item Holders", + remarks: "The way Nature interprets an entity given to $(l:patterns/types#hexcasting:compare_item/lenient)$(action)Sorter's Dstl./$ or $(l:patterns/types#hexcasting:compare_item/strict)$(action)Stacking Dstl./$ depends on its type:$(li)Item entities resolve to the items they represents$(li)Item frames resolve to the item they contain, and mishap if they are empty$(li)Players resolve to the item they are currently holding, prioritizing their primary hand" + }, + }, lists: { index: "Remove the number at the top of the stack, then replace the list at the top with the nth element of that list (where n is the number you removed). Replaces the list with $(l:casting/influences)$(thing)Null/$ if the number is out of bounds.", diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/items/edified.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/items/edified.json index 0f0863ba42..5ceeb01689 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/items/edified.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/items/edified.json @@ -20,6 +20,7 @@ }, { "type": "patchouli:crafting", + "anchor": "hexcasting:cut_edified_plank_variants", "recipe": "hexcasting:edified_stairs", "recipe2": "hexcasting:edified_slab" }, diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/akashic_patterns.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/akashic_patterns.json index fab91f4abf..d6ebf609d1 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/akashic_patterns.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/akashic_patterns.json @@ -2,7 +2,7 @@ "name": "hexcasting.entry.akashic_patterns", "category": "hexcasting:patterns", "icon": "hexcasting:akashic_bookshelf", - "sortnum": 14, + "sortnum": 15, "advancement": "hexcasting:enlightenment", "entry_color": "54398a", "pages": [ diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/circle.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/circle.json index bb0e798601..f4b452ff9f 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/circle.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/circle.json @@ -2,7 +2,7 @@ "name": "hexcasting.entry.circle_patterns", "category": "hexcasting:patterns", "icon": "hexcasting:impetus/empty", - "sortnum": 13, + "sortnum": 14, "advancement": "hexcasting:enlightenment", "entry_color": "54398a", "pages": [ diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/entities.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/entities.json index c7cf30b4f0..27a5bec8b4 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/entities.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/entities.json @@ -2,7 +2,7 @@ "name": "hexcasting.entry.entities", "category": "hexcasting:patterns", "icon": "minecraft:pig_spawn_egg", - "sortnum": 6, + "sortnum": 7, "advancement": "hexcasting:root", "read_by_default": true, "pages": [ diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/lists.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/lists.json index 8dfe25a29d..61612c34aa 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/lists.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/lists.json @@ -2,7 +2,7 @@ "name": "hexcasting.entry.lists", "category": "hexcasting:patterns", "icon": "minecraft:oak_sign", - "sortnum": 7, + "sortnum": 8, "advancement": "hexcasting:root", "read_by_default": true, "pages": [ diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/logic.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/logic.json index f321377b43..84680b4dec 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/logic.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/logic.json @@ -79,22 +79,6 @@ "output": "bool", "text": "hexcasting.page.logic.not_equals" }, - { - "type": "hexcasting:pattern", - "op_id": "hexcasting:type_equals", - "anchor": "hexcasting:type_equals", - "input": "any, any", - "output": "bool", - "text": "hexcasting.page.logic.type_equals" - }, - { - "type": "hexcasting:pattern", - "op_id": "hexcasting:type_not_equals", - "anchor": "hexcasting:type_not_equals", - "input": "any, any", - "output": "bool", - "text": "hexcasting.page.logic.type_not_equals" - }, { "type": "hexcasting:pattern", "op_id": "hexcasting:greater", diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json index 63e7f68c4a..4bb81bb6f1 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json @@ -2,7 +2,7 @@ "name": "hexcasting.entry.meta", "category": "hexcasting:patterns", "icon": "minecraft:shulker_box", - "sortnum": 12, + "sortnum": 13, "advancement": "hexcasting:root", "read_by_default": true, "pages": [ diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/patterns_as_iotas.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/patterns_as_iotas.json index 500f296893..edb11d1861 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/patterns_as_iotas.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/patterns_as_iotas.json @@ -2,7 +2,7 @@ "name": "hexcasting.entry.patterns_as_iotas", "category": "hexcasting:patterns", "icon": "minecraft:emerald", - "sortnum": 8, + "sortnum": 9, "advancement": "hexcasting:root", "read_by_default": true, "pages": [ diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/readwrite.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/readwrite.json index c661d10d73..495702887f 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/readwrite.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/readwrite.json @@ -2,7 +2,7 @@ "name": "hexcasting.entry.readwrite", "category": "hexcasting:patterns", "icon": "minecraft:writable_book", - "sortnum": 9, + "sortnum": 10, "advancement": "hexcasting:root", "read_by_default": true, "pages": [ diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/sets.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/sets.json index 936d929fcc..edc213a061 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/sets.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/sets.json @@ -2,7 +2,7 @@ "name": "hexcasting.entry.sets", "category": "hexcasting:patterns", "icon": "minecraft:bundle", - "sortnum": 11, + "sortnum": 12, "advancement": "hexcasting:root", "read_by_default": true, "pages": [ diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/types.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/types.json new file mode 100644 index 0000000000..a2f88c00b0 --- /dev/null +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/types.json @@ -0,0 +1,75 @@ +{ + "name": "hexcasting.entry.types", + "category": "hexcasting:patterns", + "icon": "hexcasting:lens", + "sortnum": 6, + "advancement": "hexcasting:root", + "read_by_default": true, + "pages": [ + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:type_equals", + "anchor": "hexcasting:type_equals", + "input": "any, any", + "output": "bool", + "text": "hexcasting.page.types.type_equals" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:type_not_equals", + "anchor": "hexcasting:type_not_equals", + "input": "any, any", + "output": "bool", + "text": "hexcasting.page.types.type_not_equals" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:compare_item/lenient", + "anchor": "hexcasting:compare_item/lenient", + "input": "entity, entity", + "output": "bool", + "text": "hexcasting.page.types.compare_item/lenient" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:compare_item/strict", + "anchor": "hexcasting:compare_item/strict", + "input": "entity, entity", + "output": "bool", + "text": "hexcasting.page.types.compare_item/strict" + }, + { + "type": "patchouli:text", + "title": "hexcasting.page.types.compare_item/remarks.title", + "text": "hexcasting.page.types.compare_item/remarks" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:compare_entity", + "anchor": "hexcasting:compare_entity", + "input": "entity, entity", + "output": "bool", + "text": "hexcasting.page.types.compare_entity" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:compare_block/lenient", + "anchor": "hexcasting:compare_block/lenient", + "input": "vec, vec", + "output": "bool", + "text": "hexcasting.page.types.compare_block/lenient" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:compare_block/strict", + "anchor": "hexcasting:compare_block/strict", + "input": "vec, vec", + "output": "bool", + "text": "hexcasting.page.types.compare_block/strict" + }, + { + "type": "patchouli:text", + "text": "hexcasting.page.types.compare_block/remarks" + } + ] +} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index 9dd280c0cf..7b42011aa3 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -153,6 +153,7 @@ object FabricHexInitializer : ModInitializer { HexArithmetics.register(bind(IXplatAbstractions.INSTANCE.arithmeticRegistry)) HexContinuationTypes.registerContinuations(bind(IXplatAbstractions.INSTANCE.continuationTypeRegistry)) HexEvalSounds.register(bind(IXplatAbstractions.INSTANCE.evalSoundRegistry)) + HexItemHolderHandlers.init() // Because of Java's lazy-loading of classes, can't use Kotlin static initialization for // any calls that will eventually touch FeatureUtils.register(), as the growers here do, diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index 638f573d22..c4618e295f 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -140,6 +140,7 @@ private static void initRegistry() { bind(HexRegistries.ARITHMETIC, HexArithmetics::register); bind(HexRegistries.CONTINUATION_TYPE, HexContinuationTypes::registerContinuations); bind(HexRegistries.EVAL_SOUND, HexEvalSounds::register); + HexItemHolderHandlers.init(); ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); ForgeHexLootMods.REGISTRY.register(getModEventBus());