diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt index f30d7d25..16bffa03 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt @@ -11,6 +11,7 @@ import at.petrak.hexcasting.api.mod.HexStatistics import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.iota.NullIota +import at.petrak.hexcasting.api.spell.iota.PatternIota import at.petrak.hexcasting.api.spell.math.HexDir import at.petrak.hexcasting.api.spell.math.HexPattern import at.petrak.hexcasting.api.spell.mishaps.* @@ -87,8 +88,8 @@ class CastingHarness private constructor( return@getUpdate CastResult(continuation, data, resolutionType, listOf()) } - return if (iota.getType() == DatumType.PATTERN) { - updateWithPattern(iota.payload as HexPattern, world, continuation) + return if (iota is PatternIota) { + updateWithPattern(iota.pattern, world, continuation) } else { CastResult( continuation, @@ -239,7 +240,7 @@ class CastingHarness private constructor( } } - fun generateDescs() = stack.map(Iota::display) + fun generateDescs() = stack.map { it.type.display(it) } /** * Return the functional update represented by the current state (for use with `copy`) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/EntityIota.java b/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/EntityIota.java index b6f9e96f..01a95186 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/EntityIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/EntityIota.java @@ -65,6 +65,11 @@ public class EntityIota extends Iota { return Component.Serializer.fromJsonLenient(nameJson); } + @Override + public Component display(EntityIota iota) { + return iota.getEntity().getName(); + } + @Override public int color() { return 0; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/IotaType.java b/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/IotaType.java index b9e3628f..7426568b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/IotaType.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/IotaType.java @@ -21,11 +21,15 @@ public abstract class IotaType { public abstract T deserialize(Tag tag, ServerLevel world) throws IllegalArgumentException; /** - * Get a display of this datum from the tag, without the world. + * Get a display of this datum from the {@code data} tag, without the world. * This is for use on the client. */ public abstract Component display(Tag tag); + public Component display(T iota) { + return this.display(iota.serialize()); + } + /** * Get the color associated with this datum type. */ diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt index 244cad32..e4ea7931 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt @@ -1,5 +1,6 @@ package at.petrak.hexcasting.fabric +import at.petrak.hexcasting.api.mod.HexStatistics import at.petrak.hexcasting.client.ClientTickCounter import at.petrak.hexcasting.client.HexAdditionalRenderers import at.petrak.hexcasting.client.RegisterClientStuff @@ -51,5 +52,7 @@ object FabricHexClientInitializer : ClientModInitializer { RegisterClientStuff.registerColorProviders { colorizer, item -> ColorProviderRegistry.ITEM.register(colorizer, item) } + + HexStatistics.register() } }