Not pointing

- Fix occasional npe in PlayerUniforms
- Mark accessor method as Nullable
This commit is contained in:
Jozufozu 2024-09-23 11:16:45 -07:00
parent 36b0ad4cf9
commit 7bd59f7b14
2 changed files with 5 additions and 2 deletions

View File

@ -40,7 +40,7 @@ public final class PlayerUniforms extends UniformWriter {
Vec3 eyePos = player.getEyePosition(context.partialTick());
ptr = writeVec3(ptr, (float) eyePos.x, (float) eyePos.y, (float) eyePos.z);
ptr = writeTeamColor(ptr, info.getTeam());
ptr = writeTeamColor(ptr, info == null ? null : info.getTeam());
ptr = writeEyeBrightness(ptr, player);
@ -54,7 +54,8 @@ public final class PlayerUniforms extends UniformWriter {
ptr = writeInt(ptr, player.isShiftKeyDown() ? 1 : 0);
ptr = writeInt(ptr, info.getGameMode().getId());
ptr = writeInt(ptr, info == null ? 0 : info.getGameMode()
.getId());
BUFFER.markDirty();
}

View File

@ -1,5 +1,6 @@
package dev.engine_room.flywheel.backend.mixin;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@ -9,5 +10,6 @@ import net.minecraft.client.player.AbstractClientPlayer;
@Mixin(AbstractClientPlayer.class)
public interface AbstractClientPlayerAccessor {
@Invoker("getPlayerInfo")
@Nullable
PlayerInfo flywheel$getPlayerInfo();
}