Cleaner code
This commit is contained in:
parent
017478b312
commit
9c3ef93695
@ -22,7 +22,7 @@ import java.math.BigDecimal;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class AndroidGui {
|
public class AndroidGui {
|
||||||
private final Minecraft mc = Minecraft.getInstance();
|
private static final Minecraft mc = Minecraft.getInstance();
|
||||||
private final ForgeIngameGui gui = mc.gui instanceof ForgeIngameGui ? (ForgeIngameGui) mc.gui : null;
|
private final ForgeIngameGui gui = mc.gui instanceof ForgeIngameGui ? (ForgeIngameGui) mc.gui : null;
|
||||||
|
|
||||||
public static final ResourceLocation PLAYER_GUI_LOCATION = new ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/player_gui.png");
|
public static final ResourceLocation PLAYER_GUI_LOCATION = new ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/player_gui.png");
|
||||||
@ -34,12 +34,10 @@ public class AndroidGui {
|
|||||||
if (!(event.getGui() instanceof DeathScreen screen))
|
if (!(event.getGui() instanceof DeathScreen screen))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LocalPlayer ply = Minecraft.getInstance().player;
|
if (mc.player == null)
|
||||||
|
|
||||||
if (ply == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ply.getCapability(MatteryCapability.ANDROID).ifPresent(cap -> {
|
mc.player.getCapability(MatteryCapability.ANDROID).ifPresent(cap -> {
|
||||||
if (cap.isAndroid())
|
if (cap.isAndroid())
|
||||||
screen.title = new TranslatableComponent("otm.death_reason");
|
screen.title = new TranslatableComponent("otm.death_reason");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user