net.minecraftforge.fml.client.FMLClientHandler Java Examples

The following examples show how to use net.minecraftforge.fml.client.FMLClientHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientProxy.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public Entity spawnParticle(net.minecraft.world.World world, Entity entity) {
	//Backward entity particle unwrapper
	if (entity instanceof BWEntityFX) {
		EntityFX entityFX = ((BWEntityFX) entity).createEntityFX(world);
		Vector3D position = entity.position();
		entityFX.posX = position.getX();
		entityFX.posY = position.getY();
		entityFX.posZ = position.getZ();
		FMLClientHandler.instance().getClient().effectRenderer.addEffect(entityFX);
		return EntityConverter.instance().toNova(entityFX);
	} else {
		FWEntityFX bwEntityFX = new FWEntityFX(world, entity);
		FMLClientHandler.instance().getClient().effectRenderer.addEffect(bwEntityFX);
		return bwEntityFX.wrapped;
	}
}
 
Example #2
Source File: DynamicTextureWrapper.java    From MediaMod with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Get resource location from url
 *
 * @param url - url to get the file from
 * @return ResourceLocation
 */
public static ResourceLocation getTexture(URL url) {
    init();
    if (!URL_TEXTURES.containsKey(url)) {
        URL_TEXTURES.put(url, new WrappedResource(null));
        queueImage(url);
    }

    WrappedResource wr = URL_TEXTURES.get(url);
    if (wr.location == null) {
        if (URL_IMAGES.get(url) != null && URL_IMAGES.get(url).image != null) {
            DynamicTexture texture = new DynamicTexture(URL_IMAGES.get(url).image);
            WrappedResource wr2 = new WrappedResource(FMLClientHandler.instance().getClient().getTextureManager().getDynamicTextureLocation(url.toString(), texture));
            URL_TEXTURES.put(url, wr2);
            return wr2.location;
        } else {
            return FULLY_TRANSPARENT_TEXTURE;
        }
    }

    return wr.location;
}
 
Example #3
Source File: TickHandler.java    From IGW-mod with GNU General Public License v2.0 6 votes vote down vote up
public static String getCurrentObjectName(){
    if(lastEntityHovered != null) {
        return lastEntityHovered.getName();
    } else {
        try {
            World world = FMLClientHandler.instance().getClient().world;
            IBlockState blockState = world.getBlockState(coordHovered);
            if(blockState != null) {
                ItemStack idPicked = blockState.getBlock().getPickBlock(blockState, FMLClientHandler.instance().getClient().objectMouseOver, world, coordHovered, FMLClientHandler.instance().getClientPlayerEntity());
                return (!idPicked.isEmpty() ? idPicked : new ItemStack(blockState.getBlock(), 1, blockState.getBlock().getMetaFromState(blockState))).getDisplayName(); //TODO test blockState.getBlock().getDamage()
            }
        } catch(Throwable e) {}
        return TextFormatting.RED + "<ERROR>";
    }

}
 
Example #4
Source File: GuiEventHandler.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onGuiOpenEvent(GuiOpenEvent event)
{
    // Reset the scrolling modifier when the player opens a GUI.
    // Otherwise the key up event will get eaten and our scrolling mode will get stuck on
    // until the player sneaks again.
    // FIXME Apparently there are key input events for GUI screens in 1.8,
    // so this probably can be removed then.
    InputEventHandler.resetModifiers();

    // Opening the player's Inventory GUI
    if (event.getGui() != null && event.getGui().getClass() == GuiInventory.class)
    {
        EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();

        if (this.handyBagShouldOpen && player != null && ItemHandyBag.getOpenableBag(player).isEmpty() == false)
        {
            if (event.isCancelable())
            {
                event.setCanceled(true);
            }

            PacketHandler.INSTANCE.sendToServer(new MessageOpenGui(player.dimension, ReferenceGuiIds.GUI_ID_HANDY_BAG));
        }
    }
}
 
Example #5
Source File: EssentialsMissingHandlerClient.java    From Cyberware with MIT License 6 votes vote down vote up
@SubscribeEvent
public void handleRenderHand(RenderHandEvent event)
{
	if (CyberwareConfig.RENDER && !(FMLClientHandler.instance().hasOptifine()) && (missingArm || missingSecondArm || hasRoboLeft || hasRoboRight))
	{
		float partialTicks = event.getPartialTicks();
		EntityRenderer er = mc.entityRenderer;
		event.setCanceled(true);
		
		
		boolean flag = mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)mc.getRenderViewEntity()).isPlayerSleeping();

		if (mc.gameSettings.thirdPersonView == 0 && !flag && !mc.gameSettings.hideGUI && !mc.playerController.isSpectator())
		{
			er.enableLightmap();
			renderItemInFirstPerson(partialTicks);
			er.disableLightmap();
		}
	}
}
 
Example #6
Source File: GlassesHUD.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
private void render2D(){
    Minecraft minecraft = FMLClientHandler.instance().getClient();
    EntityPlayer player = minecraft.player;
    ItemStack helmetStack = player.inventory.armorInventory.get(3);
    if(!helmetStack.isEmpty() && minecraft.inGameHasFocus && helmetStack.getItem() == Items.DIAMOND_HELMET) {
        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);

        GL11.glPopMatrix();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);

        for(int i = 0; i < messages.size(); i++) {
            minecraft.fontRenderer.drawString(messages.get(i).localizedMessage, 16, 16 + i * (minecraft.fontRenderer.FONT_HEIGHT + 1), 0xFF0000);
        }
    }
}
 
Example #7
Source File: MCPacketHandler.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, PacketAbstract packet) throws Exception {
	INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();

	switch (FMLCommonHandler.instance().getEffectiveSide()) {
		case CLIENT:
			FMLClientHandler.instance().getClient().addScheduledTask(() -> packet.handleClientSide(NovaMinecraft.proxy.getClientPlayer()));
			break;
		case SERVER:
			FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(() -> packet.handleServerSide(((NetHandlerPlayServer) netHandler).player));
			break;
		default:
			break;
	}

}
 
Example #8
Source File: ActionOpenModConfig.java    From Custom-Main-Menu with MIT License 6 votes vote down vote up
@Override
public void perform(Object source, GuiCustom parent)
{
	for (ModContainer mod : Loader.instance().getModList())
	{
		if (mod.getModId().equals(modid))
		{
			IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(mod);

			if (guiFactory != null)
			{
				GuiScreen newScreen = guiFactory.createConfigGui(parent);
				Minecraft.getMinecraft().displayGuiScreen(newScreen);
			}
		}
	}
}
 
Example #9
Source File: ClientProxy.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public Entity spawnParticle(net.minecraft.world.World world, Entity entity) {
	//Backward entity particle unwrapper
	if (entity instanceof BWParticle) {
		Particle particle = ((BWParticle) entity).createParticle(world);
		Vector3D position = entity.position();
		particle.posX = position.getX();
		particle.posY = position.getY();
		particle.posZ = position.getZ();
		FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle);
		return Game.natives().toNova(particle);
	} else {
		FWParticle bwEntityFX = new FWParticle(world, entity);
		FMLClientHandler.instance().getClient().effectRenderer.addEffect(bwEntityFX);
		return bwEntityFX.wrapped;
	}
}
 
Example #10
Source File: FWEntityFX.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderParticle(WorldRenderer worldRendererIn, net.minecraft.entity.Entity p_180434_2_, float p_70539_2_, float x, float y, float z, float p_70539_6_, float p_70539_7_) {
	if (firstTick) {
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;
		prevRotationYaw = rotationYaw;
		prevRotationPitch = rotationPitch;
		setPosition(posX, posY, posZ);
		firstTick = false;
	}
	float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX);
	float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY);
	float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ);

	Tessellator.getInstance().draw();
	FWEntityRenderer.render(this, wrapped, f11, f12, f13);
	Tessellator.getInstance().getWorldRenderer().startDrawingQuads();
	FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderUtility.particleResource);
}
 
Example #11
Source File: FWParticle.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderParticle(VertexBuffer worldRendererIn, net.minecraft.entity.Entity p_180434_2_, float p_70539_2_, float x, float y, float z, float p_70539_6_, float p_70539_7_) {
	if (firstTick) {
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;
		setPosition(posX, posY, posZ);
		firstTick = false;
	}
	float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX);
	float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY);
	float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ);

	Tessellator.getInstance().draw();
	FWEntityRenderer.render(this, wrapped, f11, f12, f13);
	Tessellator.getInstance().getBuffer().begin(GL_QUADS, DefaultVertexFormats.BLOCK);
	FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderUtility.particleResource);
}
 
Example #12
Source File: MCPacketHandler.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, PacketAbstract packet) throws Exception {
	INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();

	switch (FMLCommonHandler.instance().getEffectiveSide()) {
		case CLIENT:
			FMLClientHandler.instance().getClient().addScheduledTask(() -> packet.handleClientSide(NovaMinecraft.proxy.getClientPlayer()));
			break;
		case SERVER:
			FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(() -> packet.handleServerSide(((NetHandlerPlayServer) netHandler).playerEntity));
			break;
		default:
			break;
	}

}
 
Example #13
Source File: MessageTileEntitySeedStorage.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
protected void processMessage(MessageContext ctx) {
    TileEntity te = FMLClientHandler.instance().getClient().world.getTileEntity(this.pos);
    if (te instanceof TileEntitySeedStorage) {
        TileEntitySeedStorage storage = (TileEntitySeedStorage) te;
        ItemStack stack = storage.getLockedSeed().map(s -> s.toStack()).orElse(null);
        if (stack != null) {
            stack.setCount(this.amount);
            NBTTagCompound tag = new NBTTagCompound();
            stats.writeToNBT(tag);
            stack.setTagCompound(tag);
            storage.setSlotContents(this.slotId, stack);
        }
    }
}
 
Example #14
Source File: MessageSyncTileEntity.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public IMessage onMessage(final MessageSyncTileEntity message, MessageContext ctx)
{
    if (ctx.side != Side.CLIENT)
    {
        EnderUtilities.logger.error("Wrong side in MessageSyncTileEntity: " + ctx.side);
        return null;
    }

    Minecraft mc = FMLClientHandler.instance().getClient();
    final EntityPlayer player = EnderUtilities.proxy.getPlayerFromMessageContext(ctx);

    if (mc == null || player == null)
    {
        EnderUtilities.logger.error("Minecraft or player was null in MessageSyncTileEntity");
        return null;
    }

    mc.addScheduledTask(new Runnable()
    {
        public void run()
        {
            processMessage(message, player);
        }
    });

    return null;
}
 
Example #15
Source File: MessageSyncNBTTag.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public IMessage onMessage(final MessageSyncNBTTag message, MessageContext ctx)
{
    if (ctx.side != Side.CLIENT)
    {
        EnderUtilities.logger.error("Wrong side in MessageSyncNBTTag: " + ctx.side);
        return null;
    }

    final Minecraft mc = FMLClientHandler.instance().getClient();

    if (mc == null)
    {
        EnderUtilities.logger.error("Minecraft was null in MessageSyncNBTTag");
        return null;
    }

    mc.addScheduledTask(new Runnable()
    {
        public void run()
        {
            processMessage(message);
        }
    });

    return null;
}
 
Example #16
Source File: MessageAddEffects.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public IMessage onMessage(final MessageAddEffects message, MessageContext ctx)
{
    if (ctx.side != Side.CLIENT)
    {
        EnderUtilities.logger.error("Wrong side in MessageAddEffects: " + ctx.side);
        return null;
    }

    Minecraft mc = FMLClientHandler.instance().getClient();
    final EntityPlayer player = EnderUtilities.proxy.getPlayerFromMessageContext(ctx);
    if (mc == null || player == null)
    {
        EnderUtilities.logger.error("Minecraft or player was null in MessageAddEffects");
        return null;
    }

    mc.addScheduledTask(new Runnable()
    {
        public void run()
        {
            processMessage(message, player, player.getEntityWorld(), mc.getSoundHandler());
        }
    });

    return null;
}
 
Example #17
Source File: ClientProxy.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
@SubscribeEvent
public void onKeyBind(KeyInputEvent event){
    if(openInterfaceKey.isPressed()) {
        if(FMLClientHandler.instance().getClient().inGameHasFocus) {
            TickHandler.openWikiGui();
        } else {
            // handleSlotPresses();
        }
    }
}
 
Example #18
Source File: ClientProxy.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public EntityPlayer getPlayerFromMessageContext(MessageContext ctx)
{
    switch (ctx.side)
    {
        case CLIENT:
            return FMLClientHandler.instance().getClientPlayerEntity();
        case SERVER:
            return ctx.getServerHandler().player;
        default:
            EnderUtilities.logger.warn("Invalid side in getPlayerFromMessageContext(): " + ctx.side);
            return null;
    }
}
 
Example #19
Source File: BlockWikiEvent.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
public BlockWikiEvent(World world, BlockPos pos){
    super(world);
    this.pos = pos;
    blockState = world.getBlockState(pos);
    try {
        itemStackPicked = blockState.getBlock().getPickBlock(blockState, FMLClientHandler.instance().getClient().objectMouseOver, world, pos, FMLClientHandler.instance().getClientPlayerEntity());
    } catch(Throwable e) {}//FMP parts have the habit to throw a ClassCastException.
    drawnStack = !itemStackPicked.isEmpty() ? itemStackPicked : new ItemStack(blockState.getBlock(), 1, blockState.getBlock().getMetaFromState(blockState));
}
 
Example #20
Source File: MessageSyncSlot.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public IMessage onMessage(final MessageSyncSlot message, MessageContext ctx)
{
    if (ctx.side != Side.CLIENT)
    {
        EnderUtilities.logger.error("Wrong side in MessageSyncSlot: " + ctx.side);
        return null;
    }

    Minecraft mc = FMLClientHandler.instance().getClient();
    final EntityPlayer player = EnderUtilities.proxy.getPlayerFromMessageContext(ctx);

    if (mc == null || player == null)
    {
        EnderUtilities.logger.error("Minecraft or player was null in MessageSyncSlot");
        return null;
    }

    mc.addScheduledTask(new Runnable()
    {
        public void run()
        {
            processMessage(message, player);
        }
    });

    return null;
}
 
Example #21
Source File: InfoSupplier.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a wikipage for an object name.
 * @param objectName
 * @return
 */
public static List<String> getInfo(String modid, String objectName, boolean returnNullIfUnavailable){
    String language = FMLClientHandler.instance().getCurrentLanguage();

    //First try to look up the page where it should be, in the assets folder of the owning mod, local language.
    List<String> info = getInfo(modid, objectName, language);
    if(info != null) return info;

    //If we failed, we might have a backup page in english lying around.
    if(!language.equals("en_US")) {
        info = getInfo(modid, objectName, "en_US");
        if(info != null) return info;
    }

    //Let's see if we can find the page where it used to be by default, in the igwmod folder.
    if(!modid.equals("igwmod")) {
        info = getInfo("igwmod", objectName, language);
        if(info != null) {
            if(ConfigHandler.debugMode) IGWLog.warning("IGW-Mod had to look in the igwmod/assets/wiki/ folder to find the " + objectName + " page. This is deprecated. now you should use " + modid + "/assets/wiki/ instead!");
            return info;
        }

        if(!language.equals("en_US")) {
            info = getInfo("igwmod", objectName, "en_US");
            if(info != null) {
                if(ConfigHandler.debugMode) IGWLog.warning("IGW-Mod had to look in the igwmod/assets/wiki/ folder to find the " + objectName + " page. This is deprecated. now you should use " + modid + "/assets/wiki/ instead!");
                return info;
            }
        }
    }

    if(returnNullIfUnavailable) return null;
    objectName = "/assets/" + modid + "/wiki/" + language + "/" + objectName.replace(":", "/") + ".txt";
    if(objectName.length() > 50) {
        objectName = objectName.substring(0, objectName.length() / 2) + " " + objectName.substring(objectName.length() / 2, objectName.length());
    }
    return Arrays.asList("No info available about this topic. IGW-Mod is currently looking for " + objectName + ".");
}
 
Example #22
Source File: ActionConnectToServer.java    From Custom-Main-Menu with MIT License 5 votes vote down vote up
@Override
public void perform(Object source, GuiCustom menu)
{
	ServerData serverData = new ServerData(this.serverName, this.ip, false);
	FMLClientHandler.instance().setupServerList();
	FMLClientHandler.instance().connectToServer(menu, serverData);
}
 
Example #23
Source File: Util.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
public static Entity getEntityForClass(Class<? extends Entity> entityClass){
    try {
        return entityClass.getConstructor(World.class).newInstance(FMLClientHandler.instance().getClient().world);
    } catch(Exception e) {
        IGWLog.error("[LocatedEntity.java] An entity class doesn't have a constructor with a single World parameter! Entity = " + entityClass.getName());
        e.printStackTrace();
        return null;
    }
}
 
Example #24
Source File: KeyBindingHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
	EntityPlayerSP player = FMLClientHandler.instance().getClient().player;

	if(FMLClientHandler.instance().getClient().inGameHasFocus &&
			FMLClientHandler.instance().getClient().currentScreen == null)
	{
		if(Key_CombatMode.isPressed())
		{

		}
	}
}
 
Example #25
Source File: GuiWiki.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
 */
@Override
protected void keyTyped(char par1, int keyCode) throws IOException{
    if(searchField.textboxKeyTyped(par1, keyCode)) {
        currentPageLinkScroll = 0;
        updateSearch();
    } else {
        if(keyCode == ClientProxy.openInterfaceKey.getKeyCode() || keyCode == 1) {
            FMLClientHandler.instance().showGuiScreen(prevGui);
        } else {
            super.keyTyped(par1, keyCode);
        }
    }
}
 
Example #26
Source File: WikiHooks.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void showWikiGui(String pageLocation){
    GuiScreen gui = FMLClientHandler.instance().getClient().currentScreen;

    GuiWiki guiWiki = new GuiWiki();
    FMLClientHandler.instance().showGuiScreen(guiWiki);

    guiWiki.setCurrentFile(pageLocation);
    guiWiki.setPreviousScreen(gui);
}
 
Example #27
Source File: TickHandler.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
@SubscribeEvent
public void tick(TickEvent.PlayerTickEvent event){
    if(event.phase == TickEvent.Phase.END) {
        EntityPlayer player = event.player;
        if(player == FMLClientHandler.instance().getClient().player) {
            ticksExisted++;
            RayTraceResult lookedObject = FMLClientHandler.instance().getClient().objectMouseOver;
            if(lookedObject != null) {
                if(lookedObject.typeOfHit == RayTraceResult.Type.ENTITY) {
                    if(lastEntityHovered == lookedObject.entityHit) {
                        ticksHovered++;
                        coordHovered = null;
                    } else {
                        lastEntityHovered = lookedObject.entityHit;
                        ticksHovered = 0;
                        coordHovered = null;
                    }
                } else if(lookedObject.getBlockPos() != null) {
                    if(coordHovered != null && lookedObject.getBlockPos().equals(new BlockPos(coordHovered))) {
                        ticksHovered++;
                        lastEntityHovered = null;
                    } else {
                        if(!event.player.world.isAirBlock(lookedObject.getBlockPos())) {
                            ticksHovered = 0;
                            lastEntityHovered = null;
                            coordHovered = lookedObject.getBlockPos();
                        }
                    }
                }
            }
        }
    }
}
 
Example #28
Source File: BWEntityFX.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
public EntityFX createEntityFX(net.minecraft.world.World world) {
	//Look up for particle factory and pass it into BWEntityFX
	IParticleFactory particleFactory = (IParticleFactory) FMLClientHandler.instance().getClient().effectRenderer.field_178932_g.get(particleID);
	EntityFX entity = particleFactory.getEntityFX(0, world, 0, 0, 0, 0, 0, 0, 0);
	WrapperEvent.BWEntityFXCreate event = new WrapperEvent.BWEntityFXCreate(this, entity);
	Game.events().publish(event);
	return entity;
}
 
Example #29
Source File: ClientProxy.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean isPaused() {
	if (FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient().getIntegratedServer().getPublic()) {
		GuiScreen screen = FMLClientHandler.instance().getClient().currentScreen;
		if (screen != null) {
			if (screen.doesGuiPauseGame()) {
				return true;
			}
		}
	}
	return false;
}
 
Example #30
Source File: TooltipOverlayHandler.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
@SubscribeEvent
public void tickEnd(TickEvent.RenderTickEvent event){
    if(event.phase == TickEvent.Phase.END && TickHandler.showTooltip() && ConfigHandler.shouldShowTooltip && FMLClientHandler.instance().getClient().inGameHasFocus && IGWMod.proxy.getPlayer().world != null) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        ScaledResolution sr = new ScaledResolution(mc);
        FontRenderer fontRenderer = FMLClientHandler.instance().getClient().fontRenderer;
        String objectName = TickHandler.getCurrentObjectName();
        String moreInfo = "'" + Keyboard.getKeyName(ClientProxy.openInterfaceKey.getKeyCode()) + "' for more info";
        fontRenderer.drawString(objectName, sr.getScaledWidth() / 2 - fontRenderer.getStringWidth(objectName) / 2, sr.getScaledHeight() / 2 - 20, 0xFFFFFFFF);
        fontRenderer.drawString(moreInfo, sr.getScaledWidth() / 2 - fontRenderer.getStringWidth(moreInfo) / 2, sr.getScaledHeight() / 2 - 10, 0xFFFFFFFF);
    }
}