Skip to content

Commit

Permalink
Try to fix a potential crash issue (#101)
Browse files Browse the repository at this point in the history
Signed-off-by: Hendrix-Shen <[email protected]>
  • Loading branch information
Hendrix-Shen committed Aug 27, 2023
1 parent dd10d03 commit 877ab5b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import fi.dy.masa.tweakeroo.renderer.RenderUtils;
import fi.dy.masa.tweakeroo.util.RayTraceUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.Container;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
Expand All @@ -29,7 +32,8 @@ private static HitResult getRayTraceFromEntityFromCache(Level worldIn, Entity en
if (!Configs.inventoryPreviewUseCache) {
return RayTraceUtils.getRayTraceFromEntity(worldIn, entityIn, useLiquids);
} else {
return HitResultUtil.getLastHitResult();
HitResult ret = HitResultUtil.getLastHitResult();
return ret == null ? BlockHitResult.miss(Vec3.ZERO, Direction.UP, BlockPos.ZERO) : ret;
}
}

Expand Down

0 comments on commit 877ab5b

Please sign in to comment.