Search in sources :

Example 1 with MolangVariableProvider

use of io.github.ocelot.molangcompiler.api.bridge.MolangVariableProvider in project pollen by MoonflowerTeam.

the class AnimatedGeometryEntityModel method setupAnim.

@Override
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float animationTicks, float netHeadYaw, float headPitch) {
    GeometryModel model = this.getModel();
    model.resetTransformation();
    if (model instanceof AnimatedModel && this.animations.length > 0) {
        ProfilerFiller profiler = Minecraft.getInstance().getProfiler();
        profiler.push("createMolangRuntime");
        MolangRuntime.Builder builder = this.createRuntime(entity, limbSwing, limbSwingAmount, netHeadYaw, headPitch);
        if (entity instanceof MolangVariableProvider)
            builder.setVariables((MolangVariableProvider) entity);
        if (this.variableProvider != null)
            builder.setVariables(this.variableProvider);
        profiler.popPush("applyMolangAnimation");
        ((AnimatedModel) model).applyAnimations(animationTicks / 20F, builder, this.getAnimations());
        profiler.pop();
    }
}
Also used : GeometryModel(gg.moonflower.pollen.pinwheel.api.client.geometry.GeometryModel) MolangRuntime(io.github.ocelot.molangcompiler.api.MolangRuntime) MolangVariableProvider(io.github.ocelot.molangcompiler.api.bridge.MolangVariableProvider) ProfilerFiller(net.minecraft.util.profiling.ProfilerFiller)

Aggregations

GeometryModel (gg.moonflower.pollen.pinwheel.api.client.geometry.GeometryModel)1 MolangRuntime (io.github.ocelot.molangcompiler.api.MolangRuntime)1 MolangVariableProvider (io.github.ocelot.molangcompiler.api.bridge.MolangVariableProvider)1 ProfilerFiller (net.minecraft.util.profiling.ProfilerFiller)1