Skip to content

Commit

Permalink
Added proper grimoire texture and fixed some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Mar 9, 2024
1 parent 01a4b34 commit 8e98215
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class GrimoireItem : Item(Settings().maxCount(1)) {
}

fun getPatternInGrimoire (stack: ItemStack, key: HexPattern, world: ServerWorld): List<Iota>? {
val patsTag = stack.orCreateNbt.getList(key.anglesSignature(), NbtElement.COMPOUND_TYPE.toInt()) ?: return null;
val patsTag = stack.orCreateNbt.getList(key.anglesSignature(), NbtElement.COMPOUND_TYPE.toInt())
if (patsTag.isEmpty())
return null
val out = ArrayList<Iota>()
for (patTag in patsTag)
out.add(HexIotaTypes.deserialize(patTag as NbtCompound, world));
Expand Down
11 changes: 8 additions & 3 deletions common/src/main/java/miyucomics/hexical/utils/CastingUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ class CastingUtils {
if (stack.item != HexicalItems.GRIMOIRE_ITEM)
continue
val value = GrimoireItem.getPatternInGrimoire(stack, pattern, player.getWorld())
if (value != null) {
player.sendMessage(Text.literal("WOO, IT HAD A PATTERN LIST"))
if (value != null)
return value
}
for (stack in player.inventory.offHand) {
if (stack.item != HexicalItems.GRIMOIRE_ITEM)
continue
val value = GrimoireItem.getPatternInGrimoire(stack, pattern, player.getWorld())
if (value != null)
return value
}
}
return null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/knowledge_book"
"layer0": "hexical:item/grimoire"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8e98215

Please sign in to comment.