Jump to content

Render Nameplate or image above mob


charsmud

Recommended Posts

Hello!  I need to be able to display text or an image over a mob.  Is there a way to do this?  Text most likely won't be as much of an issue, but I have absolutely no idea of how to render an image over a mob like a nameplate. 

Link to comment
Share on other sites

RenderLivingEvent doesn't seem to be what I want, or I might just not be understanding it.  I found this method inside of RenderLiving:

 

    /**
     * Draws the debug or playername text above a living
     */
    protected void renderLivingLabel(EntityLiving par1EntityLiving, String par2Str, double par3, double par5, double par7, int par9)
    {
        double d3 = par1EntityLiving.getDistanceSqToEntity(this.renderManager.livingPlayer);

        if (d3 <= (double)(par9 * par9))
        {
            FontRenderer fontrenderer = this.getFontRendererFromRenderManager();
            float f = 1.6F;
            float f1 = 0.016666668F * f;
            GL11.glPushMatrix();
            GL11.glTranslatef((float)par3 + 0.0F, (float)par5 + par1EntityLiving.height + 0.5F, (float)par7);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(-f1, -f1, f1);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDepthMask(false);
            GL11.glDisable(GL11.GL_DEPTH_TEST);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            Tessellator tessellator = Tessellator.instance;
            byte b0 = 0;

            if (par2Str.equals("deadmau5"))
            {
                b0 = -10;
            }

            GL11.glDisable(GL11.GL_TEXTURE_2D);
            tessellator.startDrawingQuads();
            int j = fontrenderer.getStringWidth(par2Str) / 2;
            tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
            tessellator.addVertex((double)(-j - 1), (double)(-1 + b0), 0.0D);
            tessellator.addVertex((double)(-j - 1), (double)(8 + b0), 0.0D);
            tessellator.addVertex((double)(j + 1), (double)(8 + b0), 0.0D);
            tessellator.addVertex((double)(j + 1), (double)(-1 + b0), 0.0D);
            tessellator.draw();
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            fontrenderer.drawString(par2Str, -fontrenderer.getStringWidth(par2Str) / 2, b0, 553648127);
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glDepthMask(true);
            fontrenderer.drawString(par2Str, -fontrenderer.getStringWidth(par2Str) / 2, b0, -1);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glPopMatrix();
        }
    }

 

This seems to be how names are rendered above a mob.  Is this correct, and how can I adapt it to work with images?

Link to comment
Share on other sites

technicly its more like this

 

with some billboarding before so that the image always faces the player (if thats what you want what you really really want...wtf ?)

 

mc.renderEngine.bindTexture("path/to/image");
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(x, y, z, 0, 0);
tessellator.addVertexWithUV(x, y, z+height, 0, 1);
tessellator.addVertexWithUV(x+width, y+height, z, 1, 1);
tessellator.addVertexWithUV(x,+width y, z, 1, 0);
tessellator.draw();

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

  • 1 month later...

OK, I have made progress.... however, it seems to be glitching out. 

 

BbG7CSq.jpg

 

Here are the relevant files:

 

 

package village.mechanics;


import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.event.Event;
import net.minecraftforge.event.ForgeSubscribe;

public class VillagerBubbleHandler extends Event
{
VillageMechanics mechanics;
public VillagerBubbleHandler()
{
	mechanics = new VillageMechanics();
}
@ForgeSubscribe
public void onVillagerRender(RenderLivingEvent event)
{
	System.out.println(event.entity);
	if(event.entity instanceof EntityVillager)
	{
		mechanics.updateTradeBubble(FMLClientHandler.instance().getClient());
	}
}

}

 

 

 

package village.mechanics;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;

import org.lwjgl.opengl.GL11;


/**
* Contains information about the new Mechanics for the past
* @author Charsmud
*
*/
public class VillageMechanics
{
/**
 * Updates Paradox Bar and Renders
 * @param minecraft
 * @param amtOfParadox
 */
public void updateTradeBubble(Minecraft minecraft)
{

        Tessellator tessellator = Tessellator.instance;
        
        minecraft.renderEngine.bindTexture("/village/images/speech.png");
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV((double)1, (double)1, (double)0, (double)0, (double)0);
        tessellator.addVertexWithUV((double)1, (double)1, (double)0+600, (double)0, (double)1);
        tessellator.addVertexWithUV((double)1+776, (double)1+600, (double)0, (double)1, (double)1);
        tessellator.addVertexWithUV((double)1+776, (double)1, (double)0, (double)1, (double)0);
        tessellator.draw();
}
}

 

 

 

package village.core;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.common.MinecraftForge;
import village.mechanics.VillagerBubbleHandler;
import village.proxies.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;


@Mod(modid = "Charsmud_VillageUpgrades", name = "Village Upgrades", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)

/**
* Main laucher for VillageUpgrades
* @author Charsmud
*
*/
public class VillageUpgrades
{
@SidedProxy(clientSide = "village.proxies.ClientProxy", serverSide = "village.proxies.CommonProxy")


public static CommonProxy proxy;

@Instance
public static VillageUpgrades instance = new VillageUpgrades();

public static final String modid = "Charsmud_VillageUpgrades";


/**
 * Initiates mod, registers block and item for use.  Generates the necessary folders.
 */
@Init
public void load(FMLInitializationEvent event)
{  	
	MinecraftForge.EVENT_BUS.register(new VillagerBubbleHandler());

	proxy.registerRenderThings();

	TickRegistry.registerTickHandler(new TickerClient(), Side.CLIENT);


}


}

 

 

I am also getting this error upon start, but the game runs fine:

 

2013-08-06 13:51:03 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.2.23.737 for Minecraft 1.5.2 loading
2013-08-06 13:51:03 [iNFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_09, running on Windows 7:amd64:6.1, installed at C:\Users\Will\Desktop\eclipse-jee-juno-SR2-win32-x86_64\eclipse\jre
2013-08-06 13:51:03 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
2013-08-06 13:51:05 [iNFO] [sTDOUT] 229 recipes
2013-08-06 13:51:05 [iNFO] [sTDOUT] 27 achievements
2013-08-06 13:51:06 [iNFO] [Minecraft-Client] Setting user: Player343
2013-08-06 13:51:06 [iNFO] [sTDOUT] (Session ID is -)
2013-08-06 13:51:06 [iNFO] [sTDERR] Client asked for parameter: server
2013-08-06 13:51:06 [iNFO] [Minecraft-Client] LWJGL Version: 2.4.2
2013-08-06 13:51:06 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization
2013-08-06 13:51:06 [iNFO] [sTDOUT] MinecraftForge v7.8.1.737 Initialized
2013-08-06 13:51:06 [iNFO] [ForgeModLoader] MinecraftForge v7.8.1.737 Initialized
2013-08-06 13:51:06 [iNFO] [sTDOUT] Replaced 85 ore recipies
2013-08-06 13:51:06 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization
2013-08-06 13:51:06 [iNFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Will\Desktop\minecraftforge-src-1.5.2-7.8.1.737 - Villager\forge\mcp\jars\config\logging.properties
2013-08-06 13:51:06 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL
2013-08-06 13:51:06 [iNFO] [ForgeModLoader] Searching C:\Users\Will\Desktop\minecraftforge-src-1.5.2-7.8.1.737 - Villager\forge\mcp\jars\mods for mods
2013-08-06 13:51:08 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
2013-08-06 13:51:08 [iNFO] [mcp] Activating mod mcp
2013-08-06 13:51:08 [iNFO] [FML] Activating mod FML
2013-08-06 13:51:08 [iNFO] [Forge] Activating mod Forge
2013-08-06 13:51:08 [iNFO] [Charsmud_VillageUpgrades] Activating mod Charsmud_VillageUpgrades
2013-08-06 13:51:08 [iNFO] [ForgeModLoader] Registering Forge Packet Handler
2013-08-06 13:51:08 [iNFO] [ForgeModLoader] Succeeded registering Forge Packet Handler
2013-08-06 13:51:08 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
2013-08-06 13:51:08 [iNFO] [sTDOUT] 
2013-08-06 13:51:08 [iNFO] [sTDOUT] Starting up SoundSystem...
2013-08-06 13:51:08 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2013-08-06 13:51:08 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2013-08-06 13:51:09 [iNFO] [sTDOUT] OpenAL initialized.
2013-08-06 13:51:09 [iNFO] [sTDOUT] 
2013-08-06 13:51:09 [iNFO] [ForgeModLoader] Forge Mod Loader has detected an older LWJGL version, new advanced texture animation features are disabled
2013-08-06 13:51:09 [iNFO] [ForgeModLoader] Not using advanced OpenGL 4.3 advanced capability for animations : OpenGL 4.3 is not available
2013-08-06 13:51:09 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt
2013-08-06 13:51:09 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt
2013-08-06 13:51:09 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt
2013-08-06 13:51:09 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt
2013-08-06 13:51:09 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt
2013-08-06 13:51:09 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt
2013-08-06 13:51:09 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt
2013-08-06 13:51:10 [iNFO] [sTDERR] java.lang.InstantiationException
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at net.minecraftforge.event.EventBus.register(EventBus.java:76)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at net.minecraftforge.event.EventBus.register(EventBus.java:58)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at village.core.VillageUpgrades.load(VillageUpgrades.java:46)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.post(EventBus.java:267)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.post(EventBus.java:267)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:103)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:213)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.startGame(Minecraft.java:448)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:733)
2013-08-06 13:51:10 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2013-08-06 13:51:10 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt
2013-08-06 13:51:10 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt
2013-08-06 13:51:12 [iNFO] [Minecraft-Server] Starting integrated minecraft server version 1.5.2
2013-08-06 13:51:12 [iNFO] [Minecraft-Server] Generating keypair
2013-08-06 13:51:13 [iNFO] [ForgeModLoader] Loading dimension 0 (ds) (net.minecraft.server.integrated.IntegratedServer@75d811e7)
2013-08-06 13:51:13 [iNFO] [ForgeModLoader] Loading dimension 1 (ds) (net.minecraft.server.integrated.IntegratedServer@75d811e7)
2013-08-06 13:51:13 [iNFO] [ForgeModLoader] Loading dimension -1 (ds) (net.minecraft.server.integrated.IntegratedServer@75d811e7)
2013-08-06 13:51:13 [iNFO] [Minecraft-Server] Preparing start region for level 0
2013-08-06 13:51:14 [iNFO] [sTDOUT] loading single player
2013-08-06 13:51:14 [iNFO] [Minecraft-Server] Player343[/127.0.0.1:0] logged in with entity id 403 at (-78.67326373669563, 64.0, 313.677763770806)
2013-08-06 13:51:23 [iNFO] [Minecraft-Server] Saving and pausing game...
2013-08-06 13:51:23 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Overworld
2013-08-06 13:51:23 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Nether
2013-08-06 13:51:23 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/The End
2013-08-06 13:51:24 [iNFO] [Minecraft-Server] Saving and pausing game...
2013-08-06 13:51:24 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Overworld
2013-08-06 13:51:24 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Nether
2013-08-06 13:51:24 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/The End
2013-08-06 13:51:25 [iNFO] [Minecraft-Server] Saving and pausing game...
2013-08-06 13:51:25 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Overworld
2013-08-06 13:51:25 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Nether
2013-08-06 13:51:25 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/The End
2013-08-06 13:51:28 [iNFO] [Minecraft-Server] Saving and pausing game...
2013-08-06 13:51:28 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Overworld
2013-08-06 13:51:28 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Nether
2013-08-06 13:51:28 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/The End
2013-08-06 13:52:05 [iNFO] [Minecraft-Client] [CHAT] Saved screenshot as 2013-08-06_13.52.05.png
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving and pausing game...
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Overworld
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Nether
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/The End
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Stopping server
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving players
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving worlds
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Overworld
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/Nether
2013-08-06 13:52:06 [iNFO] [Minecraft-Server] Saving chunks for level 'ds'/The End
2013-08-06 13:52:07 [iNFO] [ForgeModLoader] Unloading dimension 0
2013-08-06 13:52:07 [iNFO] [ForgeModLoader] Unloading dimension -1
2013-08-06 13:52:07 [iNFO] [ForgeModLoader] Unloading dimension 1
2013-08-06 13:52:08 [iNFO] [Minecraft-Client] Stopping!
2013-08-06 13:52:08 [iNFO] [sTDOUT] 
2013-08-06 13:52:08 [iNFO] [sTDOUT] SoundSystem shutting down...
2013-08-06 13:52:08 [iNFO] [sTDOUT]     Author: Paul Lamb, www.paulscode.com
2013-08-06 13:52:08 [iNFO] [sTDOUT] 

 

 

I also tried using the nameplate rendering code directly from EntityLiving.java, but that just glitched out and did not have the results that I want.  Any idea?

Link to comment
Share on other sites

I'm a bit of a noob at OpenGL

nah that ok, a lot of ppl mod without having any ogl knowledge (and it bites them in the ass alter but :P)

 

basicly when youre calling your updateTradeBubble also pass the event that comes with it becuase it hold which entity is being rendered.

now take the difference between the local player and the entity and translate by that amount

 

code ish

EntityPlayer localPlayer = Minecraft.getMinecraft().thePlayer;
double x = localPlayer.posX - event.entity.posX;
same for y, smae for z
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
//your render code here
GL11.glPopMatrix();

 

it might be event.entity.posX-localPlayer.posX or the other way aroudn, try both if one doesnt work :P

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Hm.... neither of those worked.  Nothing now appears.  Here's what I have edited:

 

 

package village.mechanics;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.RenderLivingEvent;

import org.lwjgl.opengl.GL11;


/**
* Contains information about the new Mechanics for the past
* @author Charsmud
*
*/
public class VillageMechanics
{
/**
 * Updates Paradox Bar and Renders
 * @param minecraft
 * @param amtOfParadox
 */
public void updateTradeBubble(Minecraft minecraft, RenderLivingEvent event)
{

        Tessellator tessellator = Tessellator.instance;
        
        GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);

        EntityPlayer localPlayer = Minecraft.getMinecraft().thePlayer;
        double x = event.entity.posX - localPlayer.posX;
        double y = event.entity.posY - localPlayer.posY;
        double z = event.entity.posZ - localPlayer.posZ;
        //double x = localPlayer.posX - event.entity.posX;
        //double y = localPlayer.posY - event.entity.posY;
        //double z = localPlayer.posZ - event.entity.posZ;

        GL11.glPushMatrix();
        GL11.glTranslated(x, y, z);
        
        minecraft.renderEngine.bindTexture("/village/images/speech.png");
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV((double)1, (double)1, (double)0, (double)0, (double)0);
        tessellator.addVertexWithUV((double)1, (double)1, (double)0+600, (double)0, (double)1);
        tessellator.addVertexWithUV((double)1+776, (double)1+600, (double)0, (double)1, (double)1);
        tessellator.addVertexWithUV((double)1+776, (double)1, (double)0, (double)1, (double)0);
        tessellator.draw();
        
        GL11.glPopMatrix();

}
}

 

 

 

package village.mechanics;


import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.event.Event;
import net.minecraftforge.event.ForgeSubscribe;

public class VillagerBubbleHandler extends Event
{
VillageMechanics mechanics;
public VillagerBubbleHandler()
{
	mechanics = new VillageMechanics();
}
@ForgeSubscribe
public void onVillagerRender(RenderLivingEvent event)
{
	if(event.entity instanceof EntityVillager)
	{
		mechanics.updateTradeBubble(FMLClientHandler.instance().getClient(), event);
	}
}
}

 

 

I was going to learn OGL but then I settled with Direct3D instead.  xD  Have any idea why it's not rendering?

Link to comment
Share on other sites

Now I cannot get it to render at all!  :(

 

Here are my files:

 

 

package village.mechanics;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;

import org.lwjgl.opengl.GL11;


/**
* Contains information about the new Mechanics for the past
* @author Charsmud
*
*/
public class VillageMechanics
{
/**
 * Updates Paradox Bar and Renders
 * @param minecraft
 * @param amtOfParadox
 */
public void updateTradeBubble(Minecraft minecraft)
{
        Tessellator tessellator = Tessellator.instance;

	minecraft.renderEngine.bindTexture("/village/images/speech.png");
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(1, 1, 0, 0, 0);
	tessellator.addVertexWithUV(1, 1, 0+600, 0, 1);
	tessellator.addVertexWithUV(1+776, 1+600, 0, 1, 1);
	tessellator.addVertexWithUV(1, 1+776, 0, 1, 0);
	tessellator.draw();

}
}

 

 

 

package village.mechanics;


import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.event.Event;
import net.minecraftforge.event.ForgeSubscribe;

public class VillagerBubbleHandler
{
public VillagerBubbleHandler()
{
}
@ForgeSubscribe
public void onVillagerRender(RenderLivingEvent event)
{
	VillageMechanics mechanics = new VillageMechanics();

	if(event.entity instanceof EntityVillager)
	{
		mechanics.updateTradeBubble(FMLClientHandler.instance().getClient());
	}
}

}

 

 

 

package village.core;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.common.MinecraftForge;
import village.mechanics.VillagerBubbleHandler;
import village.proxies.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;


@Mod(modid = "Charsmud_VillageUpgrades", name = "Village Upgrades", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)

/**
* Main laucher for VillageUpgrades
* @author Charsmud
*
*/
public class VillageUpgrades
{
@SidedProxy(clientSide = "village.proxies.ClientProxy", serverSide = "village.proxies.CommonProxy")


public static CommonProxy proxy;

@Instance
public static VillageUpgrades instance = new VillageUpgrades();

public static final String modid = "Charsmud_VillageUpgrades";


/**
 * Initiates mod, registers block and item for use.  Generates the necessary folders.
 */
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
	MinecraftForge.EVENT_BUS.register(new VillagerBubbleHandler());
}
@Init
public void load(FMLInitializationEvent event)
{  	

	proxy.registerRenderThings();

	TickRegistry.registerTickHandler(new TickerClient(), Side.CLIENT);


}


}

 

 

I have NO idea why it's not working when Its a copy-paste of what I had before.  The image is in the right place. 

Link to comment
Share on other sites

3 things

first:

tessellator.addVertexWithUV(1, 1, 0, 0, 0);
tessellator.addVertexWithUV(1, 1, 0+600, 0, 1);
tessellator.addVertexWithUV(1+776, 1+600, 0, 1, 1);
tessellator.addVertexWithUV(1, 1+776, 0, 1, 0);

this square is WAY too big, basicly this would mean 776 block long in minecraft world by 600 block long

 

2 try System.out.println("i executed from "+*insert class name*);

    try to see if:

    - the event handler is being registered correctly

    -the event is called

  --your code makes it to the render code

 

change this:

 

public void updateTradeBubble(Minecraft minecraft)
{
        Tessellator tessellator = Tessellator.instance;

	minecraft.renderEngine.bindTexture("/village/images/speech.png");
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(1, 1, 0, 0, 0);
	tessellator.addVertexWithUV(1, 1, 0+600, 0, 1);
	tessellator.addVertexWithUV(1+776, 1+600, 0, 1, 1);
	tessellator.addVertexWithUV(1, 1+776, 0, 1, 0);
	tessellator.draw();

}

to this: (it will allow you to see both side of the quad)

public void updateTradeBubble(Minecraft minecraft)
{
        Tessellator tessellator = Tessellator.instance;

	minecraft.renderEngine.bindTexture("/village/images/speech.png");
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(1, 1, 0, 0, 0);
	tessellator.addVertexWithUV(1, 1, 0+600, 0, 1);
	tessellator.addVertexWithUV(1+776, 1+600, 0, 1, 1);
	tessellator.addVertexWithUV(1, 1+776, 0, 1, 0);

                tessellator.addVertexWithUV(1, 1, 0, 0, 0);
	tessellator.addVertexWithUV(1, 1+776, 0, 1, 0);
	tessellator.addVertexWithUV(1+776, 1+600, 0, 1, 1);
	tessellator.addVertexWithUV(1, 1, 0+600, 0, 1);
	tessellator.draw();

}

 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

OK, I added prints here:

 

 

	public void updateTradeBubble(Minecraft minecraft)
{
	System.out.println("EXECUTED FROM VILLAGEMECHANICS");
        Tessellator tessellator = Tessellator.instance;

	minecraft.renderEngine.bindTexture("/village/images/bubble1.png");
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(1, 1, 0, 0, 0);
	tessellator.addVertexWithUV(1, 1, 0+2, 0, 1);
	tessellator.addVertexWithUV(1+1, 1+2, 0, 1, 1);
	tessellator.addVertexWithUV(1, 1+1, 0, 1, 0);

        tessellator.addVertexWithUV(1, 1, 0, 0, 0);
	tessellator.addVertexWithUV(1, 1+1, 0, 1, 0);
	tessellator.addVertexWithUV(1+1, 1+2, 0, 1, 1);
	tessellator.addVertexWithUV(1, 1, 0+2, 0, 1);
	tessellator.draw();

}

 

 

 

	public void onVillagerRender(RenderLivingEvent event)
{
	VillageMechanics mechanics = new VillageMechanics();

	if(event.entity instanceof EntityVillager)
	{
		System.out.println("EXECUTED FROM VILLAGERBUBBLEHANDLER");
		mechanics.updateTradeBubble(FMLClientHandler.instance().getClient());
	}
}

 

 

None of those prints print.

 

I also added some in the main mod file, but those print just fine.  I also edited the tesselator addVertexWithUVs...  is this a more reasonable size?

Link to comment
Share on other sites

about the size, youll see when it renders for real, but it might be too big anyway, but its deffinitelly in the "reasonable size" :P

 

well then now you knwo that you dont register it correctly :P

did you change something there ?

make a println before MinecraftForge.EVENT_BUS.register(Object);

 

if it doesnt print, then you know the method that is SUPPOSE to register it isnt being called, try to see why (if you cant find anything, use code tag to paste your main mod class, common proxy and client proxy

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

I put prints in the @PreInit. 

 

package village.core;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.common.MinecraftForge;
import village.mechanics.VillagerBubbleHandler;
import village.proxies.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;


@Mod(modid = "Charsmud_VillageUpgrades", name = "Village Upgrades", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)

/**
* Main laucher for VillageUpgrades
* @author Charsmud
*
*/
public class VillageUpgrades
{
@SidedProxy(clientSide = "village.proxies.ClientProxy", serverSide = "village.proxies.CommonProxy")


public static CommonProxy proxy;

@Instance
public static VillageUpgrades instance = new VillageUpgrades();

public static final String modid = "Charsmud_VillageUpgrades";


/**
 * Initiates mod, registers block and item for use.  Generates the necessary folders.
 */
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
	System.out.println("EXECUTED FRMO VILLAGEUPGRADES");
	MinecraftForge.EVENT_BUS.register(new VillagerBubbleHandler());
	System.out.println("EXECUTED FROM VILLAGEUPGRADES PRINT 2");
}
@Init
public void load(FMLInitializationEvent event)
{  	

	proxy.registerRenderThings();

	TickRegistry.registerTickHandler(new TickerClient(), Side.CLIENT);


}


}

 

 

Both print just fine.  My CommonProxy and ClientProxy:

 

 

package village.proxies;

public class CommonProxy 
{
public void registerRenderThings()
{

}

}

 

 

package village.proxies;

public class ClientProxy extends CommonProxy
{
@Override
public void registerRenderThings()
{

}
}

 

 

I believe that it is initializing correctly, but I get this error on load, but the game still loads:

 

2013-08-07 10:41:39 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.2.23.737 for Minecraft 1.5.2 loading
2013-08-07 10:41:39 [iNFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_09, running on Windows 7:amd64:6.1, installed at C:\Users\Will\Desktop\eclipse-jee-juno-SR2-win32-x86_64\eclipse\jre
2013-08-07 10:41:39 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
2013-08-07 10:41:42 [iNFO] [sTDOUT] 229 recipes
2013-08-07 10:41:42 [iNFO] [sTDOUT] 27 achievements
2013-08-07 10:41:42 [iNFO] [Minecraft-Client] Setting user: Player659
2013-08-07 10:41:42 [iNFO] [sTDOUT] (Session ID is -)
2013-08-07 10:41:42 [iNFO] [sTDERR] Client asked for parameter: server
2013-08-07 10:41:42 [iNFO] [Minecraft-Client] LWJGL Version: 2.4.2
2013-08-07 10:41:43 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization
2013-08-07 10:41:43 [iNFO] [sTDOUT] MinecraftForge v7.8.1.737 Initialized
2013-08-07 10:41:43 [iNFO] [ForgeModLoader] MinecraftForge v7.8.1.737 Initialized
2013-08-07 10:41:43 [iNFO] [sTDOUT] Replaced 85 ore recipies
2013-08-07 10:41:43 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization
2013-08-07 10:41:43 [iNFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Will\Desktop\minecraftforge-src-1.5.2-7.8.1.737 - Villager\forge\mcp\jars\config\logging.properties
2013-08-07 10:41:43 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL
2013-08-07 10:41:43 [iNFO] [ForgeModLoader] Searching C:\Users\Will\Desktop\minecraftforge-src-1.5.2-7.8.1.737 - Villager\forge\mcp\jars\mods for mods
2013-08-07 10:41:44 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
2013-08-07 10:41:44 [iNFO] [mcp] Activating mod mcp
2013-08-07 10:41:44 [iNFO] [FML] Activating mod FML
2013-08-07 10:41:44 [iNFO] [Forge] Activating mod Forge
2013-08-07 10:41:44 [iNFO] [Charsmud_VillageUpgrades] Activating mod Charsmud_VillageUpgrades
2013-08-07 10:41:44 [iNFO] [ForgeModLoader] Registering Forge Packet Handler
2013-08-07 10:41:44 [iNFO] [ForgeModLoader] Succeeded registering Forge Packet Handler
2013-08-07 10:41:44 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
2013-08-07 10:41:44 [iNFO] [sTDOUT] EXECUTED FRMO VILLAGEUPGRADES
2013-08-07 10:41:44 [iNFO] [sTDERR] java.lang.InstantiationException
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at net.minecraftforge.event.EventBus.register(EventBus.java:76)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at net.minecraftforge.event.EventBus.register(EventBus.java:58)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at village.core.VillageUpgrades.preInit(VillageUpgrades.java:47)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.post(EventBus.java:267)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.post(EventBus.java:267)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:103)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.loadMods(Loader.java:515)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:163)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.startGame(Minecraft.java:411)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:733)
2013-08-07 10:41:44 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2013-08-07 10:41:44 [iNFO] [sTDOUT] EXECUTED FROM VILLAGEUPGRADES PRINT 2
2013-08-07 10:41:45 [iNFO] [sTDOUT] 
2013-08-07 10:41:45 [iNFO] [sTDOUT] Starting up SoundSystem...
2013-08-07 10:41:45 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2013-08-07 10:41:45 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2013-08-07 10:41:45 [iNFO] [sTDOUT] OpenAL initialized.
2013-08-07 10:41:45 [iNFO] [sTDOUT] 
2013-08-07 10:41:46 [iNFO] [ForgeModLoader] Forge Mod Loader has detected an older LWJGL version, new advanced texture animation features are disabled
2013-08-07 10:41:46 [iNFO] [ForgeModLoader] Not using advanced OpenGL 4.3 advanced capability for animations : OpenGL 4.3 is not available
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt
2013-08-07 10:41:46 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt
2013-08-07 10:41:46 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt
2013-08-07 10:41:47 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt
2013-08-07 10:41:47 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt
2013-08-07 10:42:11 [iNFO] [Minecraft-Server] Starting integrated minecraft server version 1.5.2
2013-08-07 10:42:11 [iNFO] [Minecraft-Server] Generating keypair
2013-08-07 10:42:11 [iNFO] [ForgeModLoader] Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@66bf349f)
2013-08-07 10:42:11 [iNFO] [ForgeModLoader] Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@66bf349f)
2013-08-07 10:42:11 [iNFO] [ForgeModLoader] Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@66bf349f)
2013-08-07 10:42:11 [iNFO] [Minecraft-Server] Preparing start region for level 0
2013-08-07 10:42:13 [iNFO] [sTDOUT] loading single player
2013-08-07 10:42:13 [iNFO] [Minecraft-Server] Player659[/127.0.0.1:0] logged in with entity id 346 at (-126.2266029604828, 70.0, 246.11333630926705)
2013-08-07 10:42:28 [iNFO] [Minecraft-Server] Saving and pausing game...
2013-08-07 10:42:28 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2013-08-07 10:42:28 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether
2013-08-07 10:42:28 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End
2013-08-07 10:42:29 [iNFO] [Minecraft-Server] Stopping server
2013-08-07 10:42:29 [iNFO] [Minecraft-Server] Saving players
2013-08-07 10:42:29 [iNFO] [Minecraft-Server] Saving worlds
2013-08-07 10:42:29 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2013-08-07 10:42:29 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether
2013-08-07 10:42:29 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End
2013-08-07 10:42:29 [iNFO] [ForgeModLoader] Unloading dimension 0
2013-08-07 10:42:29 [iNFO] [ForgeModLoader] Unloading dimension -1
2013-08-07 10:42:29 [iNFO] [ForgeModLoader] Unloading dimension 1
2013-08-07 10:42:31 [iNFO] [Minecraft-Client] Stopping!
2013-08-07 10:42:31 [iNFO] [sTDOUT] 
2013-08-07 10:42:31 [iNFO] [sTDOUT] SoundSystem shutting down...
2013-08-07 10:42:31 [iNFO] [sTDOUT]     Author: Paul Lamb, www.paulscode.com
2013-08-07 10:42:31 [iNFO] [sTDOUT] 

 

 

Link to comment
Share on other sites

before i dig in further, can you move it from preinit to init ? and try again ? (specially look out for the error in the logs )

it wouldnt be bad trying it but in my case it didnt trigger any error :\

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

aaaaaaaaahhhhhhhhhhhh nvm i foudn it, turn out you cannot make a RenderLivingEvent because its an abstract class

you must either make a RenderLivingEvent.Pre or RenderLivingEvent.Post (use pre)

 

aka

 

@ForgeSubscribe
public void handlerRenderLiving(RenderLivingEvent.Pre event){
//usual render code
}

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

I think I might use ogl for something like this.  It's a little dirtier, but you're allowed more flexibility.

 

here's some example code:

 

	@ForgeSubscribe
public void render(RenderWorldLastEvent event)
{

	//allows for rendering relative to you
	EntityClientPlayerMP player = mc.thePlayer;
	double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.partialTicks; 
	double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.partialTicks;
	double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.partialTicks;
	//keep in mind that the event.partial ticks is important - it's taken from the event RenderWorldLastEvent
	//you can just put the partial ticks in your function call if you dont want to render from the same
	//function that you subscribe to the event system.

//starts ogl rendering and things
GL11.glPushMatrix();
//makes sure we get the right type of render
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_DEPTH_TEST);


GL11.glLineWidth(6);

//translates your draw space to wherever you are
GL11.glTranslated(-playerX, -playerY, -playerZ);
GL11.glColor3ub((byte)253,(byte)0,(byte)0);


//sets our draw focus relaltive to us.  Just a stupid little variable.  In this case,
//I'm drawing a line at 9,9,9.  However, you can just draw whatever you want using what
//-ever coordinates you choose.
float mx = 9;
float my = 9;
float mz = 9;
//drawing stuff.  OGL should have a text draw function, as well as texture rendering.
//you'll have to look up how to import textures and stuff with ogl.
//also, you'll need to learn more about ogl.  It's probably worth it in the end.
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint( GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST );
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex3f(mx,my,mz+1f);
GL11.glVertex3f(mx,my,mz-1f);
GL11.glEnd();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glPopMatrix();
}

 

You'll also need to learn a little about forge events and how they're handled.  It's good experience though.

Link to comment
Share on other sites

the tessellator is an api build on top of opengl , when you're using the tessellator, you're using opengl directly :P

 

also, hes trying to draw triangles (2 to make a quad)

 

GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint( GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST );
GL11.glBegin(GL11.GL_LINE_STRIP);

not lines xD

 

yet it reassures me to see someone else with openGL knowledge.

 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://mclo.gs/4UC49Ao
    • Way back in the Forge 1.17 days, work started for adding JPMS (Java Platform Module Support) to ModLauncher and ForgeModLoader. This has been used internally by Forge and some libraries for a while now, but mods (those with mods.toml specifically) have not been able to take advantage of it. As of Forge 1.21.1 and 1.21.3, this is now possible!   What is JPMS and what does it mean for modders? JPMS is the Java Platform Module System, introduced in Java 9. It allows you to define modules, which are collections of packages and resources that can be exported or hidden from other modules. This allows for much more fine-tuned control over visibility, cleaner syntax for service declarations and support for sealed types across packages. For example, you might have a mod with a module called `com.example.mod` that exports `com.example.mod.api` and `com.example.mod.impl` to other mods, but hides `com.example.mod.internal` from them. This would allow you to have a clean API for other mods to use, while keeping your internal implementation details hidden from IDE hints, helping prevent accidental usage of internals that might break without prior notice. This is particularly useful if you'd like to use public records with module-private constructors or partially module-private record components, as you can create a sealed interface that only your record implements, having the interface be exported and the record hidden. It's also nice for declaring and using services, as you'll get compile-time errors from the Java compiler for typos and the like, rather than deferring to runtime errors. In more advanced cases, you can also have public methods that are only accessible to specific other modules -- handy if you want internal interactions between multiple of your own mods.   How do I bypass it? We understand there may be drama in implementing a system that prevents mods from accessing each other's internals when necessary (like when a mod is abandoned or you need to fix a compat issue) -- after all, we are already modding a game that doesn't have explicit support for Java mods yet. We have already thought of this and are offering APIs from day one to selectively bypass module restrictions. Let me be clear: Forge mods are not required to use JPMS. If you don't want to use it, you don't have to. The default behaviour is to have fully open, fully exported automatic modules. In Java, you can use the `Add-Opens` and `Add-Exports` manifest attributes to selectively bypass module restrictions of other mods at launch time, and we've added explicit support for these when loading your Forge mods. At compile-time, you can use existing solutions such as the extra-java-module-info Gradle plugin to deal with non-modular dependencies and add extra opens and exports to other modules. Here's an example on how to make the internal package `com.example.examplemod.internal` open to your mod in your build.gradle: tasks.named('jar', Jar) { manifest { attributes([ 'Add-Opens' : 'com.example.examplemod/com.example.examplemod.internal' 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors // (...) ]) } } With the above in your mod's jar manifest, you can now reflectively access the classes inside that internal package. Multiple entries are separated with a space, as per Java's official spec. You can also use Add-Exports to directly call without reflection, however you'd need to use the Gradle plugin mentioned earlier to be able to compile. The syntax for Add-Exports is the same as Add-Opens, and instructions for the compile-time step with the Gradle plugin are detailed later in this post. Remember to prefer the opens and exports keywords inside module-info.java for sources you control. The Add-Opens/Add-Exports attributes are only intended for forcing open other mods.   What else is new with module support? Previously, the runtime module name was always forced to the first mod ID in your `mods.toml` file and all packages were forced fully open and exported. Module names are now distinguished from mod IDs, meaning the module name in your module-info.java can be different from the mod ID in your `mods.toml`. This allows you to have a more descriptive module name that doesn't have to be the same as your mod ID, however we strongly recommend including your mod ID as part of your module name to aid troubleshooting. The `Automatic-Module-Name` manifest attribute is now also honoured, allowing you to specify a module name for your mod without needing to create a `module-info.java` file. This is particularly useful for mods that don't care about JPMS features but want to have a more descriptive module name and easier integration with other mods that do use JPMS.   How do I use it? The first step is to create a `module-info.java` file in your mod's source directory. This file should be in the same package as your main mod class, and should look something like this: open module com.example.examplemod { requires net.minecraftforge.eventbus; requires net.minecraftforge.fmlcore; requires net.minecraftforge.forge; requires net.minecraftforge.javafmlmod; requires net.minecraftforge.mergetool.api; requires org.slf4j; requires logging; } For now, we're leaving the whole module open to reflection, which is a good starting point. When we know we want to close something off, we can remove the open modifier from the module and open or export individual packages instead. Remember that you need to be open to Forge (module name net.minecraftforge.forge), otherwise it can't call your mod's constructor. Next is fixing modules in Gradle. While Forge and Java support modules properly, Gradle does not put automatic modules on the module path by default, meaning that the logging module (from com.mojang:logging) is not found. To fix this, add the Gradle plugin and add a compile-time module definition for that Mojang library: plugins { // (...) id 'org.gradlex.extra-java-module-info' version "1.9" } // (...) extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule("com.mojang:logging", "logging") } The automatic module override specified in your build.gradle should match the runtime one to avoid errors. You can do the same for any library or mod dependency that is missing either a module-info or explicit Automatic-Module-Name, however be aware that you may need to update your mod once said library adds one. That's all you need to get started with module support in your mods. You can learn more about modules and how to use them at dev.java.
    • Faire la mise à jour grâce à ce lien m'a aider personnellement, merci à @Paint_Ninja. https://www.amd.com/en/support 
    • When I came across the 'Exit Code: I got a 1 error in my Minecraft mods, so I decided to figure out what was wrong. First, I took a look at the logs. In the mods folder (usually where you'd find logs or crash reports), I found the latest.log file or the corresponding crash report. I read it through carefully, looking for any lines with errors or warnings. Then I checked the Minecraft Forge support site, where you can often find info on what causes errors and how to fix them. I then disabled half of my mods and tried running the game. If the error disappeared, it meant that the problem was with the disabled mod. I repeated this several times to find the problem mod.
    • I have no idea - switch to a pre-configured modpack and use it as working base    
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.