Skip to content

Commit

Permalink
Fixed crash due to mods that don't provide textures for their entity. F…
Browse files Browse the repository at this point in the history
…ixes #238
  • Loading branch information
Sollace committed Oct 6, 2023
1 parent 4e2b488 commit 9019147
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package eu.ha3.presencefootsteps.sound.generator;

import org.jetbrains.annotations.Nullable;

import com.minelittlepony.api.pony.meta.Race;
import com.minelittlepony.client.MineLittlePony;

Expand All @@ -24,8 +26,14 @@ public static boolean hasPonies() {

public static Locomotion getLocomotion(Entity entity, Locomotion fallback) {

@Nullable
Identifier texture = MinecraftClient.getInstance().getEntityRenderDispatcher().getRenderer(entity).getTexture(entity);

if (texture == null) {
// Bad modder. /slap
return fallback;
}

Race race = MineLittlePony.getInstance().getManager().getPony(texture).race();

if (race.isHuman()) {
Expand Down

0 comments on commit 9019147

Please sign in to comment.