Skip to content

Commit

Permalink
Add a method to render a spell using the dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Jan 21, 2024
1 parent 3827deb commit e09ade5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ public void render(MatrixStack matrices, VertexConsumerProvider vertices, Placea

matrices.pop();

var renderer = SpellEffectsRenderDispatcher.INSTANCE.getRenderer(delegate);
if (renderer != null) {
renderer.render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
}
SpellEffectsRenderDispatcher.INSTANCE.render(matrices, vertices, delegate, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ public <S extends Spell> SpellRenderer<S> getRenderer(S spell) {
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) {
caster.getSpellSlot().forEach(spell -> {
var renderer = getRenderer(spell);
if (renderer != null) {
renderer.render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
}
render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
return Operation.SKIP;
}, false);

Expand Down

0 comments on commit e09ade5

Please sign in to comment.