use of micdoodle8.mods.galacticraft.core.client.gui.screen.GuiNewSpaceRace in project Galacticraft by micdoodle8.
the class TickHandlerClient method onRenderTick.
@SubscribeEvent
public void onRenderTick(RenderTickEvent event) {
final Minecraft minecraft = FMLClientHandler.instance().getClient();
final EntityPlayerSP player = minecraft.thePlayer;
final EntityPlayerSP playerBaseClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false);
if (player == null || playerBaseClient == null) {
return;
}
GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerBaseClient);
;
if (event.phase == Phase.END) {
if (minecraft.currentScreen instanceof GuiIngameMenu) {
int i = Mouse.getEventX() * minecraft.currentScreen.width / minecraft.displayWidth;
int j = minecraft.currentScreen.height - Mouse.getEventY() * minecraft.currentScreen.height / minecraft.displayHeight - 1;
int k = Mouse.getEventButton();
if (Minecraft.isRunningOnMac && k == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) {
k = 1;
}
int deltaColor = 0;
if (i > minecraft.currentScreen.width - 100 && j > minecraft.currentScreen.height - 35) {
deltaColor = 20;
if (k == 0) {
if (Mouse.getEventButtonState()) {
minecraft.displayGuiScreen(new GuiNewSpaceRace(playerBaseClient));
}
}
}
this.drawGradientRect(minecraft.currentScreen.width - 100, minecraft.currentScreen.height - 35, minecraft.currentScreen.width, minecraft.currentScreen.height, ColorUtil.to32BitColor(150, 10 + deltaColor, 10 + deltaColor, 10 + deltaColor), ColorUtil.to32BitColor(250, 10 + deltaColor, 10 + deltaColor, 10 + deltaColor));
minecraft.fontRendererObj.drawString(GCCoreUtil.translate("gui.space_race.create.title.name.0"), minecraft.currentScreen.width - 50 - minecraft.fontRendererObj.getStringWidth(GCCoreUtil.translate("gui.space_race.create.title.name.0")) / 2, minecraft.currentScreen.height - 26, ColorUtil.to32BitColor(255, 240, 240, 240));
minecraft.fontRendererObj.drawString(GCCoreUtil.translate("gui.space_race.create.title.name.1"), minecraft.currentScreen.width - 50 - minecraft.fontRendererObj.getStringWidth(GCCoreUtil.translate("gui.space_race.create.title.name.1")) / 2, minecraft.currentScreen.height - 16, ColorUtil.to32BitColor(255, 240, 240, 240));
Gui.drawRect(minecraft.currentScreen.width - 100, minecraft.currentScreen.height - 35, minecraft.currentScreen.width - 99, minecraft.currentScreen.height, ColorUtil.to32BitColor(255, 0, 0, 0));
Gui.drawRect(minecraft.currentScreen.width - 100, minecraft.currentScreen.height - 35, minecraft.currentScreen.width, minecraft.currentScreen.height - 34, ColorUtil.to32BitColor(255, 0, 0, 0));
}
ClientProxyCore.playerPosX = player.prevPosX + (player.posX - player.prevPosX) * event.renderTickTime;
ClientProxyCore.playerPosY = player.prevPosY + (player.posY - player.prevPosY) * event.renderTickTime;
ClientProxyCore.playerPosZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.renderTickTime;
ClientProxyCore.playerRotationYaw = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * event.renderTickTime;
ClientProxyCore.playerRotationPitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.renderTickTime;
if (minecraft.currentScreen == null && player.ridingEntity instanceof EntitySpaceshipBase && minecraft.gameSettings.thirdPersonView != 0 && !minecraft.gameSettings.hideGUI) {
OverlayRocket.renderSpaceshipOverlay(((EntitySpaceshipBase) player.ridingEntity).getSpaceshipGui());
}
if (minecraft.currentScreen == null && player.ridingEntity instanceof EntityLander && minecraft.gameSettings.thirdPersonView != 0 && !minecraft.gameSettings.hideGUI) {
OverlayLander.renderLanderOverlay();
}
if (minecraft.currentScreen == null && player.ridingEntity instanceof EntityAutoRocket && minecraft.gameSettings.thirdPersonView != 0 && !minecraft.gameSettings.hideGUI) {
OverlayDockingRocket.renderDockingOverlay();
}
if (minecraft.currentScreen == null && player.ridingEntity instanceof EntitySpaceshipBase && minecraft.gameSettings.thirdPersonView != 0 && !minecraft.gameSettings.hideGUI && ((EntitySpaceshipBase) minecraft.thePlayer.ridingEntity).launchPhase < EnumLaunchPhase.LAUNCHED.ordinal()) {
OverlayLaunchCountdown.renderCountdownOverlay();
}
if (player.worldObj.provider instanceof IGalacticraftWorldProvider && OxygenUtil.shouldDisplayTankGui(minecraft.currentScreen) && OxygenUtil.noAtmosphericCombustion(player.worldObj.provider) && !playerBaseClient.isSpectator() && !minecraft.gameSettings.showDebugInfo) {
int var6 = (TickHandlerClient.airRemaining - 90) * -1;
if (TickHandlerClient.airRemaining <= 0) {
var6 = 90;
}
int var7 = (TickHandlerClient.airRemaining2 - 90) * -1;
if (TickHandlerClient.airRemaining2 <= 0) {
var7 = 90;
}
int thermalLevel = stats.getThermalLevel() + 22;
OverlayOxygenTanks.renderOxygenTankIndicator(thermalLevel, var6, var7, !ConfigManagerCore.oxygenIndicatorLeft, !ConfigManagerCore.oxygenIndicatorBottom, Math.abs(thermalLevel - 22) >= 10 && !stats.isThermalLevelNormalising());
}
if (playerBaseClient != null && player.worldObj.provider instanceof IGalacticraftWorldProvider && !stats.isOxygenSetupValid() && OxygenUtil.noAtmosphericCombustion(player.worldObj.provider) && minecraft.currentScreen == null && !minecraft.gameSettings.hideGUI && !playerBaseClient.capabilities.isCreativeMode && !playerBaseClient.isSpectator()) {
OverlayOxygenWarning.renderOxygenWarningOverlay();
}
}
}
use of micdoodle8.mods.galacticraft.core.client.gui.screen.GuiNewSpaceRace in project Galacticraft by micdoodle8.
the class GuiHandler method getClientGuiElement.
@SideOnly(Side.CLIENT)
private Object getClientGuiElement(int ID, EntityPlayer player, World world, BlockPos position) {
EntityPlayerSP playerClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false);
if (ID == GuiIdsCore.GALAXY_MAP) {
return new GuiCelestialSelection(true, null);
} else if (ID == GuiIdsCore.ROCKET_INVENTORY && player.ridingEntity instanceof EntityTieredRocket) {
return new GuiRocketInventory(player.inventory, (EntityTieredRocket) player.ridingEntity, ((EntityTieredRocket) player.ridingEntity).getType());
} else if (ID == GuiIdsCore.EXTENDED_INVENTORY) {
return new GuiExtendedInventory(player, ClientProxyCore.dummyInventory);
} else if (ID == GuiIdsCore.SPACE_RACE_START) {
return new GuiNewSpaceRace(player);
} else if (ID == GuiIdsCore.SPACE_RACE_JOIN) {
return new GuiJoinSpaceRace(playerClient);
} else if (ID == GuiIdsCore.PRE_LAUNCH_CHECKLIST) {
return new GuiPreLaunchChecklist(WorldUtil.getAllChecklistKeys(), player.getHeldItem().hasTagCompound() ? (NBTTagCompound) player.getHeldItem().getTagCompound().getTag("checklistData") : null);
}
TileEntity tile = world.getTileEntity(position);
if (tile != null) {
if (tile instanceof TileEntityCrafting) {
return new GuiCrafting(player.inventory, (TileEntityCrafting) tile);
} else if (tile instanceof TileEntityRefinery) {
return new GuiRefinery(player.inventory, (TileEntityRefinery) world.getTileEntity(position));
} else if (tile instanceof TileEntityOxygenCollector) {
return new GuiOxygenCollector(player.inventory, (TileEntityOxygenCollector) tile);
} else if (tile instanceof TileEntityOxygenDistributor) {
return new GuiOxygenDistributor(player.inventory, (TileEntityOxygenDistributor) tile);
} else if (tile instanceof TileEntityFuelLoader) {
return new GuiFuelLoader(player.inventory, (TileEntityFuelLoader) tile);
} else if (tile instanceof TileEntityOxygenSealer) {
return new GuiOxygenSealer(player.inventory, (TileEntityOxygenSealer) tile);
} else if (tile instanceof TileEntityCargoLoader) {
return new GuiCargoLoader(player.inventory, (TileEntityCargoLoader) tile);
} else if (tile instanceof TileEntityCargoUnloader) {
return new GuiCargoUnloader(player.inventory, (TileEntityCargoUnloader) tile);
} else if (tile instanceof TileEntityParaChest) {
return new GuiParaChest(player.inventory, (TileEntityParaChest) tile);
} else if (tile instanceof TileEntitySolar) {
return new GuiSolar(player.inventory, (TileEntitySolar) tile);
} else if (tile instanceof TileEntityAirLockController) {
return new GuiAirLockController((TileEntityAirLockController) tile);
} else if (tile instanceof TileEntityEnergyStorageModule) {
return new GuiEnergyStorageModule(player.inventory, (TileEntityEnergyStorageModule) tile);
} else if (tile instanceof TileEntityCoalGenerator) {
return new GuiCoalGenerator(player.inventory, (TileEntityCoalGenerator) tile);
} else if (tile instanceof TileEntityElectricFurnace) {
return new GuiElectricFurnace(player.inventory, (TileEntityElectricFurnace) tile);
} else if (tile instanceof TileEntityIngotCompressor) {
return new GuiIngotCompressor(player.inventory, (TileEntityIngotCompressor) tile);
} else if (tile instanceof TileEntityElectricIngotCompressor) {
return new GuiElectricIngotCompressor(player.inventory, (TileEntityElectricIngotCompressor) tile);
} else if (tile instanceof TileEntityCircuitFabricator) {
return new GuiCircuitFabricator(player.inventory, (TileEntityCircuitFabricator) tile);
} else if (tile instanceof TileEntityOxygenStorageModule) {
return new GuiOxygenStorageModule(player.inventory, (TileEntityOxygenStorageModule) tile);
} else if (tile instanceof TileEntityOxygenCompressor) {
return new GuiOxygenCompressor(player.inventory, (TileEntityOxygenCompressor) tile);
} else if (tile instanceof TileEntityOxygenDecompressor) {
return new GuiOxygenDecompressor(player.inventory, (TileEntityOxygenDecompressor) tile);
} else if (tile instanceof TileEntityDeconstructor) {
return new GuiDeconstructor(player.inventory, (TileEntityDeconstructor) tile);
} else if (tile instanceof TileEntityPainter) {
return new GuiPainter(player.inventory, (TileEntityPainter) tile);
}
}
if (playerClient != null) {
GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerClient);
for (ISchematicPage page : stats.getUnlockedSchematics()) {
if (ID == page.getGuiID()) {
GuiScreen screen = page.getResultScreen(playerClient, position);
if (screen instanceof ISchematicResultPage) {
((ISchematicResultPage) screen).setPageIndex(page.getPageID());
}
return screen;
}
}
}
return null;
}
Aggregations