Add a method to render a spell using the dispatcher

This commit is contained in:
Sollace 2024-01-21 15:19:49 +00:00
parent 3827deb235
commit e09ade57b1
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 9 additions and 8 deletions

View file

@ -72,10 +72,7 @@ public class PlacedSpellRenderer implements SpellRenderer<PlaceableSpell> {
matrices.pop(); matrices.pop();
var renderer = SpellEffectsRenderDispatcher.INSTANCE.getRenderer(delegate); SpellEffectsRenderDispatcher.INSTANCE.render(matrices, vertices, delegate, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
if (renderer != null) {
renderer.render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
}
} }
} }

View file

@ -64,12 +64,16 @@ public class SpellEffectsRenderDispatcher implements SynchronousResourceReloader
return (SpellRenderer<S>)renderers.get(spell.getType()); return (SpellRenderer<S>)renderers.get(spell.getType());
} }
public void render(MatrixStack matrices, VertexConsumerProvider vertices, Spell spell, Caster<?> caster, int light, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
var renderer = getRenderer(spell);
if (renderer != null) {
renderer.render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
}
}
public void render(MatrixStack matrices, VertexConsumerProvider vertices, int light, Caster<?> caster, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) { public void render(MatrixStack matrices, VertexConsumerProvider vertices, int light, Caster<?> caster, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
caster.getSpellSlot().forEach(spell -> { caster.getSpellSlot().forEach(spell -> {
var renderer = getRenderer(spell); render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
if (renderer != null) {
renderer.render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
}
return Operation.SKIP; return Operation.SKIP;
}, false); }, false);