Hello..
I'm trying to code this mod which tells you if you're inventory is full, and if it is, it render the stats (GUI) into the screen, For example I have a simple GUI on the left corner of my screen that says Inventory stats: Full <-- that's if its full, If its not full and can still contain items it says Inventory stats: Empty
So here's my code..
Main class
package me.q8minecraft.fullinv;
import com.q8minecraft.event.ScreenRender;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@Mod(modid = FullInv.MODID, version = FullInv.VERSION, name = FullInv.NAME)
public class FullInv {
public final static String MODID = "FullInv";
public final static String NAME = "FullInv";
public final static String VERSION = "1.0.0";
@EventHandler
public void init(FMLInitializationEvent e) {
MinecraftForge.EVENT_BUS.register(new ScreenRender());
}
}
ScreenRender class:
package com.q8minecraft.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
public class ScreenRender {
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent e) {
if(e.type == ElementType.JUMPBAR || e.type == ElementType.EXPERIENCE) {
Minecraft.getMinecraft().fontRenderer.drawString("Inventory Stats: ", 2, 2, 0xFFFFFF);
}
}
}