more manual fixes

This commit is contained in:
gamma-delta 2022-06-13 20:29:30 -05:00
parent 6f4497a18f
commit 8261063208
4 changed files with 17 additions and 4 deletions

View file

@ -11,6 +11,7 @@ import at.petrak.hexcasting.api.mod.HexStatistics
import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.*
import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.iota.NullIota 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.HexDir
import at.petrak.hexcasting.api.spell.math.HexPattern import at.petrak.hexcasting.api.spell.math.HexPattern
import at.petrak.hexcasting.api.spell.mishaps.* import at.petrak.hexcasting.api.spell.mishaps.*
@ -87,8 +88,8 @@ class CastingHarness private constructor(
return@getUpdate CastResult(continuation, data, resolutionType, listOf()) return@getUpdate CastResult(continuation, data, resolutionType, listOf())
} }
return if (iota.getType() == DatumType.PATTERN) { return if (iota is PatternIota) {
updateWithPattern(iota.payload as HexPattern, world, continuation) updateWithPattern(iota.pattern, world, continuation)
} else { } else {
CastResult( CastResult(
continuation, 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`) * Return the functional update represented by the current state (for use with `copy`)

View file

@ -65,6 +65,11 @@ public class EntityIota extends Iota {
return Component.Serializer.fromJsonLenient(nameJson); return Component.Serializer.fromJsonLenient(nameJson);
} }
@Override
public Component display(EntityIota iota) {
return iota.getEntity().getName();
}
@Override @Override
public int color() { public int color() {
return 0; return 0;

View file

@ -21,11 +21,15 @@ public abstract class IotaType<T extends Iota> {
public abstract T deserialize(Tag tag, ServerLevel world) throws IllegalArgumentException; public abstract T deserialize(Tag tag, ServerLevel world) throws IllegalArgumentException;
/** /**
* Get a display of this datum from the tag, <i>without</i> the world. * Get a display of this datum from the {@code data} tag, <i>without</i> the world.
* This is for use on the client. * This is for use on the client.
*/ */
public abstract Component display(Tag tag); public abstract Component display(Tag tag);
public Component display(T iota) {
return this.display(iota.serialize());
}
/** /**
* Get the color associated with this datum type. * Get the color associated with this datum type.
*/ */

View file

@ -1,5 +1,6 @@
package at.petrak.hexcasting.fabric package at.petrak.hexcasting.fabric
import at.petrak.hexcasting.api.mod.HexStatistics
import at.petrak.hexcasting.client.ClientTickCounter import at.petrak.hexcasting.client.ClientTickCounter
import at.petrak.hexcasting.client.HexAdditionalRenderers import at.petrak.hexcasting.client.HexAdditionalRenderers
import at.petrak.hexcasting.client.RegisterClientStuff import at.petrak.hexcasting.client.RegisterClientStuff
@ -51,5 +52,7 @@ object FabricHexClientInitializer : ClientModInitializer {
RegisterClientStuff.registerColorProviders { colorizer, item -> RegisterClientStuff.registerColorProviders { colorizer, item ->
ColorProviderRegistry.ITEM.register(colorizer, item) ColorProviderRegistry.ITEM.register(colorizer, item)
} }
HexStatistics.register()
} }
} }