use of gregtech.api.terminal.app.ARApplication in project GregTech by GregTechCEu.
the class TerminalARRenderer method onClientTick.
public static void onClientTick(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.END) {
EntityPlayer player = Minecraft.getMinecraft().player;
if (player == null) {
if (APP != null) {
APP.onARClosed();
APP = null;
}
return;
}
HELD_HAND = EnumHand.MAIN_HAND;
NBTTagCompound tag = player.getHeldItem(EnumHand.MAIN_HAND).getSubCompound("terminal");
if (tag == null) {
tag = player.getHeldItem(EnumHand.OFF_HAND).getSubCompound("terminal");
HELD_HAND = EnumHand.OFF_HAND;
}
if (tag != null && tag.hasKey("_ar")) {
AbstractApplication app = TerminalRegistry.getApplication(tag.getString("_ar"));
if (app instanceof ARApplication) {
if (APP != app) {
if (APP != null) {
APP.onARClosed();
}
APP = (ARApplication) app;
APP.setAROpened(player.getHeldItem(HELD_HAND));
APP.onAROpened();
}
APP.tickAR(player);
return;
}
}
if (APP != null) {
APP.onARClosed();
APP = null;
}
}
}
Aggregations