1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-12-03 21:08:06 +00:00

Update to latest NullAway

This fixes several issues with @Nullable fields not being checked. This
is great in principle, but a little annoying in practice as MC's
@Nullable annotations are sometimes a little overly strict -- we now
need to wrap a couple of things in assertNonNull checks.
This commit is contained in:
Jonathan Coates
2024-04-06 08:38:44 +01:00
parent bce099ef32
commit 8b2516abb5
11 changed files with 41 additions and 23 deletions

View File

@@ -32,6 +32,8 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import java.util.Objects;
import static dan200.computercraft.core.util.Nullability.assertNonNull;
public class ComputerCraftClient {
@@ -77,7 +79,7 @@ public class ComputerCraftClient {
if (hit.getType() != HitResult.Type.BLOCK) return ItemStack.EMPTY;
var pos = ((BlockHitResult) hit).getBlockPos();
var level = Minecraft.getInstance().level;
var level = Objects.requireNonNull(Minecraft.getInstance().level);
var state = level.getBlockState(pos);
if (!(state.getBlock() instanceof CableBlock cable)) return ItemStack.EMPTY;