use of me.desht.pneumaticcraft.common.CommonHUDHandler in project pnc-repressurized by TeamPneumatic.
the class HUDHandler method render2D.
private void render2D(float partialTicks) {
Minecraft minecraft = FMLClientHandler.instance().getClient();
EntityPlayer player = minecraft.player;
ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (minecraft.inGameHasFocus && helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
ScaledResolution sr = new ScaledResolution(minecraft);
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glPushMatrix();
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
GL11.glColor4d(0, 1, 0, 0.8D);
CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime()) {
// blockTrackInfo = null;
gaveEmptyWarning = false;
gaveNearlyEmptyWarning = false;
RenderProgressBar.render(sr.getScaledWidth() / 2, 10, sr.getScaledWidth() - 10, 30, -90F, comHudHandler.ticksExisted * 100 / comHudHandler.getStartupTime());
} else {
if (comHudHandler.helmetPressure < 0.05F && !gaveEmptyWarning) {
addMessage(new ArmorMessage("The helmet is out of air!", new ArrayList<String>(), 100, 0x70FF0000));
gaveEmptyWarning = true;
}
if (comHudHandler.helmetPressure > 0.2F && comHudHandler.helmetPressure < 0.5F && !gaveNearlyEmptyWarning) {
addMessage(new ArmorMessage("The helmet almost out of air!", new ArrayList<String>(), 60, 0x70FF0000));
gaveNearlyEmptyWarning = true;
}
if (GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked) {
for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
IUpgradeRenderHandler upgradeRenderHandler = UpgradeRenderHandlerList.instance().upgradeRenderers.get(i);
if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + upgradeRenderHandler.getUpgradeName()).checked) {
IGuiAnimatedStat stat = upgradeRenderHandler.getAnimatedStat();
if (stat != null) {
stat.render(-1, -1, partialTicks);
}
upgradeRenderHandler.render2D(partialTicks, comHudHandler.helmetPressure > 0F);
}
}
}
}
// render every item in the list.
for (ArmorMessage message : messageList) {
message.renderMessage(minecraft.fontRenderer, partialTicks);
}
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_TEXTURE_2D);
if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime())
minecraft.fontRenderer.drawString(CommonHUDHandler.getHandlerForPlayer().ticksExisted * 100 / comHudHandler.getStartupTime() + "%", sr.getScaledWidth() * 3 / 4 - 8, 16, 0x000000);
} else if (helmetStack.isEmpty()) {
messageList.clear();
}
}
use of me.desht.pneumaticcraft.common.CommonHUDHandler in project pnc-repressurized by TeamPneumatic.
the class HUDHandler method update.
private void update(EntityPlayer player) {
for (ArmorMessage message : messageList) {
message.getStat().update();
}
CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
boolean helmetEnabled = GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked;
if (comHudHandler.ticksExisted == 1) {
for (IUpgradeRenderHandler handler : UpgradeRenderHandlerList.instance().upgradeRenderers) {
handler.reset();
}
for (int i = 0; i < comHudHandler.upgradeRenderersEnabled.length; i++) {
NetworkHandler.sendToServer(new PacketToggleHelmetFeature((byte) i, helmetEnabled && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).getUpgradeName()).checked));
}
}
if (comHudHandler.ticksExisted > comHudHandler.getStartupTime() && helmetEnabled) {
for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
IUpgradeRenderHandler upgradeRenderHandler = UpgradeRenderHandlerList.instance().upgradeRenderers.get(i);
if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + upgradeRenderHandler.getUpgradeName()).checked) {
IGuiAnimatedStat stat = upgradeRenderHandler.getAnimatedStat();
if (stat != null) {
if (comHudHandler.helmetPressure > 0F) {
stat.openWindow();
} else {
stat.closeWindow();
}
stat.update();
}
upgradeRenderHandler.update(player, comHudHandler.rangeUpgradesInstalled);
}
}
}
// clean the list
for (int i = 0; i < messageList.size(); i++) {
ArmorMessage message = messageList.get(i);
if (message == null || --message.lifeSpan <= 0) {
messageList.remove(i);
i--;
}
}
for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
if (comHudHandler.ticksExisted == comHudHandler.getStartupTime() / (UpgradeRenderHandlerList.instance().upgradeRenderers.size() + 2) * (i + 1)) {
player.world.playSound(player.posX, player.posY, player.posZ, Sounds.HUD_INIT, SoundCategory.PLAYERS, 0.1F, 0.5F + (float) (i + 1) / (UpgradeRenderHandlerList.instance().upgradeRenderers.size() + 2) * 0.5F, true);
boolean upgradeEnabled = comHudHandler.upgradeRenderersInserted[i];
addMessage(new ArmorMessage(I18n.format("pneumaticHelmet.upgrade." + UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).getUpgradeName()) + " " + (upgradeEnabled ? "found" : "not installed"), new ArrayList<String>(), 50, upgradeEnabled ? 0x7000AA00 : 0x70FF0000));
}
}
if (comHudHandler.ticksExisted == 1) {
player.world.playSound(player.posX, player.posY, player.posZ, Sounds.HUD_INIT, SoundCategory.PLAYERS, 0.1F, 0.5F, true);
addMessage(new ArmorMessage("Initializing head-up display...", Collections.emptyList(), 50, 0x7000AA00));
}
if (comHudHandler.ticksExisted == comHudHandler.getStartupTime()) {
player.world.playSound(player.posX, player.posY, player.posZ, Sounds.HUD_INIT_COMPLETE, SoundCategory.PLAYERS, 0.1F, 1.0F, true);
addMessage(new ArmorMessage("Initialization complete!", Collections.emptyList(), 50, 0x7000AA00));
}
}
use of me.desht.pneumaticcraft.common.CommonHUDHandler in project pnc-repressurized by TeamPneumatic.
the class HUDHandler method renderWorldLastEvent.
@SubscribeEvent
public void renderWorldLastEvent(RenderWorldLastEvent event) {
if (!GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked)
return;
Minecraft mc = FMLClientHandler.instance().getClient();
EntityPlayer player = mc.player;
double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.getPartialTicks();
double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.getPartialTicks();
double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.getPartialTicks();
GL11.glPushMatrix();
GL11.glTranslated(-playerX, -playerY, -playerZ);
ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
if (((IPressurizable) helmetStack.getItem()).getPressure(helmetStack) > 0F) {
CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
if (comHudHandler.ticksExisted > comHudHandler.getStartupTime()) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).getUpgradeName()).checked)
UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).render3D(event.getPartialTicks());
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}
}
GL11.glPopMatrix();
}
use of me.desht.pneumaticcraft.common.CommonHUDHandler in project pnc-repressurized by TeamPneumatic.
the class ClientProxy method preInit.
@Override
public void preInit() {
TintedOBJLoader.INSTANCE.addDomain(Names.MOD_ID);
ModelLoaderRegistry.registerLoader(TintedOBJLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(LoaderProgrammingPuzzle.INSTANCE);
ModelLoaderRegistry.registerLoader(PressureGlassModelLoader.INSTANCE);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPressureTube.class, new RenderPressureTubeModule());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAphorismTile.class, new RenderAphorismTile());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAirCannon.class, new RenderAirCannon());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPneumaticDoor.class, new RenderPneumaticDoor());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAssemblyController.class, new RenderAssemblyController());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAssemblyIOUnit.class, new RenderAssemblyIOUnit());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAssemblyPlatform.class, new RenderAssemblyPlatform());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAssemblyLaser.class, new RenderAssemblyLaser());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAssemblyDrill.class, new RenderAssemblyDrill());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChargingStation.class, new RenderChargingStation());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityElevatorBase.class, new RenderElevatorBase());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityElevatorCaller.class, new RenderElevatorCaller());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityUniversalSensor.class, new RenderUniversalSensor());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVacuumPump.class, new RenderVacuumPump());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRefinery.class, new RenderRefinery());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLiquidHopper.class, new RenderLiquidHopper());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityKeroseneLamp.class, new RenderKeroseneLamp());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPlasticMixer.class, new RenderPlasticMixer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityThermopneumaticProcessingPlant.class, new RenderThermopneumaticProcessingPlant());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySentryTurret.class, new RenderSentryTurret());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySecurityStation.class, new RenderSecurityStation());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPressureChamberValve.class, new RenderPressureChamber());
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
MinecraftForge.EVENT_BUS.register(HUDHandler.instance());
MinecraftForge.EVENT_BUS.register(ClientTickHandler.instance());
MinecraftForge.EVENT_BUS.register(getHackTickHandler());
MinecraftForge.EVENT_BUS.register(clientHudHandler = new CommonHUDHandler());
MinecraftForge.EVENT_BUS.register(new ClientSemiBlockManager());
MinecraftForge.EVENT_BUS.register(HUDHandler.instance().getSpecificRenderer(CoordTrackUpgradeHandler.class));
MinecraftForge.EVENT_BUS.register(AreaShowManager.getInstance());
MinecraftForge.EVENT_BUS.register(KeyHandler.getInstance());
ThirdPartyManager.instance().clientSide();
/* if(Config.enableUpdateChecker) {
UpdateChecker.instance().start();
MinecraftForge.EVENT_BUS.register(UpdateChecker.instance());
}*/
EntityTrackHandler.registerDefaultEntries();
getAllKeybindsFromOptionsFile();
// disabled for now, it won't work
// new IGWSupportNotifier();
RenderingRegistry.registerEntityRenderingHandler(EntityVortex.class, RenderEntityVortex.FACTORY);
RenderingRegistry.registerEntityRenderingHandler(EntityDrone.class, RenderDrone.REGULAR_FACTORY);
RenderingRegistry.registerEntityRenderingHandler(EntityLogisticsDrone.class, RenderDrone.LOGISTICS_FACTORY);
RenderingRegistry.registerEntityRenderingHandler(EntityProgrammableController.class, RenderDrone.REGULAR_FACTORY);
super.preInit();
}
Aggregations