Skip to content

Commit

Permalink
perf(geckolib): remove a bunch of string splitting and string creatio…
Browse files Browse the repository at this point in the history
…n at render time
  • Loading branch information
bernie-g committed Mar 9, 2024
1 parent 0b2d011 commit 90cefce
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.eliotlash.molang.ast.Evaluatable;
import com.eliotlash.molang.ast.Evaluator;
import com.eliotlash.molang.variables.ExecutionContext;
import com.eliotlash.molang.variables.VariableFlavor;
import org.apache.commons.lang3.tuple.Pair;
import software.bernie.geckolib3.core.AnimationState;
import software.bernie.geckolib3.core.IAnimatable;
Expand Down Expand Up @@ -363,7 +364,7 @@ public void registerCustomInstructionListener(ICustomInstructionListener<T> cust
public void process(double tick, AnimationEvent<T> event, List<IBone> modelRendererList,
HashMap<String, Pair<IBone, BoneSnapshot>> boneSnapshotCollection, Evaluator evaluator,
ExecutionContext context, boolean crashWhenCantFindBone) {
context.setVariable("query.life_time", tick / 20);
context.setVariable(VariableFlavor.QUERY, "life_time", tick / 20);

if (currentAnimation != null) {
IAnimatableModel<T> model = getModel(this.animatable);
Expand Down Expand Up @@ -525,7 +526,7 @@ public void process(double tick, AnimationEvent<T> event, List<IBone> modelRende
}

private void setAnimTime(ExecutionContext context, double tick) {
context.setVariable("query.anim_time", tick / 20);
context.setVariable(VariableFlavor.QUERY, "anim_time", tick / 20);
}

@SuppressWarnings("unchecked")
Expand Down

0 comments on commit 90cefce

Please sign in to comment.