Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.minecraftforge.fluids.FluidType;
import org.jetbrains.annotations.Nullable;
import xyz.bluspring.kilt.injections.world.entity.EntityInjection;
import xyz.bluspring.kilt.util.KiltHelper;

import java.util.Collection;
import java.util.function.BiPredicate;
Expand Down Expand Up @@ -233,9 +234,19 @@ default float getStepHeight()
return this.kilt$getStepHeight(() -> self().maxUpStep());
}

ThreadLocal<Boolean> kilt$isCheckingHeight = ThreadLocal.withInitial(() -> false);

// Kilt: Custom provider to allow compat with other mods :D
default float kilt$getStepHeight(Supplier<Float> vanillaStepProvider)
{
if (KiltHelper.INSTANCE.hasMethodOverride(this.getClass(), IForgeEntity.class, "getStepHeight") && !kilt$isCheckingHeight.get()) {
try {
kilt$isCheckingHeight.set(true);
return getStepHeight();
} finally {
kilt$isCheckingHeight.set(false);
}
}
float vanillaStep = vanillaStepProvider.get();
if (self() instanceof LivingEntity living)
{
Expand Down