Jump to content

Render Nameplate or image above mob


charsmud
 Share

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
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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It's using the java 19 version, hence the error. You can do the same exact thing for Java 17 if you want. You could also just put in the absolute path instead of copying it to the server folder. Same way you add any environment variable. It's not specific to only java.
    • I am using a modified MeleeAttackGoal to make an entity pick a random button, go to it and press it. But after a while it just stops and stares at the current button target. I found out that it's just staring at it because it's too far away to press it.  And its's not moving because the current path in the mob navigation is "done". If I move it further away it recalculates a non weird path and fixes itself. If I push it towards the button so it can press it, it sets the target to null, so it once again calculates a new path and fixes itself. What is causing the path to be "done"? And how can I fix this? This is the tick method in the custom goal class: public void tick() { if (mob.buttonTarget != null) { float x = mob.buttonTarget.getX(); float y = mob.buttonTarget.getY(); float z = mob.buttonTarget.getZ(); float hx = x + 0.5f; float hy = y + 0.5f; float hz = z + 0.5f; mob.getLookControl().setLookAt(hx, hy, hz, 30.0F, 30.0F); double distSqr = mob.distanceToSqr(hx, hy, hz); ticksUntilNextPathRecalculation = Math.max(ticksUntilNextPathRecalculation - 1, 0); if ((followingTargetEvenIfNotSeen || hasLineOfSight(mob, mob.buttonTarget)) && ticksUntilNextPathRecalculation <= 0 && ((pathedTargetX == 0.0D && pathedTargetY == 0.0D && pathedTargetZ == 0.0D) || mob.buttonTarget.distSqr(new Vec3i(pathedTargetX, pathedTargetY, pathedTargetZ)) >= 1.0D || mob.getRandom().nextFloat() < 0.05F)) { pathedTargetX = hx; pathedTargetY = hy; pathedTargetZ = hz; ticksUntilNextPathRecalculation = 4 + mob.getRandom().nextInt(7); if (distSqr > 1024.0D) ticksUntilNextPathRecalculation += 10; else if (distSqr > 256.0D) ticksUntilNextPathRecalculation += 5; Path newPath = mob.getNavigation().createPath(mob.buttonTarget, 0); if (newPath != null && !newPath.canReach()) { mob.buttonTarget = null; return; } if (!mob.getNavigation().moveTo(newPath, speedModifier)) ticksUntilNextPathRecalculation += 15; ticksUntilNextPathRecalculation = adjustedTickDelay(ticksUntilNextPathRecalculation); } ticksUntilNextAttack = Math.max(getTicksUntilNextAttack() - 1, 0); checkAndPerformAttack(mob.buttonTarget, distSqr); } }  
    • As of Forge version 44.1.5 and above, Minecraft has started crashing whenever I played it with the Create mod. Without any mods, it loads normally, but when I put in a mod, like MrCrayfish's furniture mod for example, it fails to read the mod properly. Basically I press play and it loads. When the launcher closes, it opens back up again with an Exit Code 1 error, stating that the game crashed due to an unexpected error. Here's my latest.log for more information. https://pastebin.com/pUPBjpbr  
    • The files are harmed by system flaws and glitches. Additionally, the installation procedure might cause files to be lost. The game is so terminated, and an exit code 1 error is displayed. Therefore, attempt a game reinstall.
    • Hello there!  I'm hosting a Minecraft Tekxit PI server on Minecraft 1.12.2 on my computer and I have a little issue. Everything was going great until one day my light in my house went down while a friend was inside the server. The server crashed and when I came back 2 chunks swapped but everything seemed normal. Fastforward in time my friend who was inside the server tried to come back in it but everti-me he tries to join he cannot do it and there is a crash in the server logs. If any other friend tries to join they can, but, that friend that was inside the server when that occurred cannot join. I tried rebooting, rebooting my modem, deleting his player data to start over and nothing works. I'm leaving the crash logs here. Thank you!!! ----------------------------------------------- CRASH LOGS   [10:27:10] [Netty Server IO #1/INFO]: Transforming class 'gu', alias 'net.minecraft.network.NettyCompressionDecoder' [10:27:10] [Netty Server IO #1/INFO]: Scanning method 'decode(Lio/netty/channel/ChannelHandlerContext;Lio/netty/buffer/ByteBuf;Ljava/util/List;)V' [10:27:10] [Netty Server IO #1/INFO]: Patching constant (java.lang.Integer) 2097152 [10:27:10] [Netty Server IO #1/INFO]: Patching constant (java.lang.Integer) 2097152 [10:27:10] [Netty Server IO #1/INFO]: [com.creativemd.creativecore.transformer.CreativeTransformer:transform:49]: [littletiles] Patched net.minecraft.network.NettyCompressionDecoder ... [10:27:13] [Server thread/ERROR]: HandshakeMessageHandler exception java.lang.OutOfMemoryError: Java heap space     at java.util.ArrayList.<init>(Unknown Source) ~[?:1.8.0_361]     at com.google.common.collect.Lists.newArrayListWithCapacity(Lists.java:190) ~[minecraft_server.1.12.2.jar:?]     at net.minecraft.nbt.NBTTagList.read(NBTTagList.java:58) ~[ge.class:?]     at net.minecraft.nbt.NBTTagCompound.readNBT(NBTTagCompound.java:497) ~[fy.class:?]     at net.minecraft.nbt.NBTTagCompound.read(NBTTagCompound.java:58) ~[fy.class:?]     at net.minecraft.nbt.NBTTagCompound.readNBT(NBTTagCompound.java:497) ~[fy.class:?]     at net.minecraft.nbt.NBTTagCompound.read(NBTTagCompound.java:58) ~[fy.class:?]     at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:133) ~[gi.class:?]     at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:88) ~[gi.class:?]     at net.minecraft.nbt.CompressedStreamTools.readCompressed(CompressedStreamTools.java:31) ~[gi.class:?]     at net.minecraft.world.storage.SaveHandler.getPlayerNBT(SaveHandler.java:278) ~[bfb.class:?]     at net.minecraft.server.management.PlayerList.getPlayerNBT(PlayerList.java:340) ~[pl.class:?]     at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.serverInitiateHandshake(NetworkDispatcher.java:220) ~[NetworkDispatcher.class:?]     at net.minecraftforge.fml.common.network.handshake.FMLHandshakeServerState$1.accept(FMLHandshakeServerState.java:49) ~[FMLHandshakeServerState$1.class:?]     at net.minecraftforge.fml.common.network.handshake.HandshakeMessageHandler.userEventTriggered(HandshakeMessageHandler.java:65) ~[HandshakeMessageHandler.class:?]     at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:329) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:315) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:307) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.ChannelInboundHandlerAdapter.userEventTriggered(ChannelInboundHandlerAdapter.java:108) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:329) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:315) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:307) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.ChannelInboundHandlerAdapter.userEventTriggered(ChannelInboundHandlerAdapter.java:108) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:329) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:315) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:307) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.DefaultChannelPipeline$HeadContext.userEventTriggered(DefaultChannelPipeline.java:1352) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:329) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:315) ~[minecraft_server.1.12.2.jar:?]     at io.netty.channel.DefaultChannelPipeline.fireUserEventTriggered(DefaultChannelPipeline.java:920) ~[minecraft_server.1.12.2.jar:?]     at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.insertIntoChannel(NetworkDispatcher.java:183) ~[NetworkDispatcher.class:?]     at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.serverToClientHandshake(NetworkDispatcher.java:154) ~[NetworkDispatcher.class:?]
  • Topics

×
×
  • Create New...

Important Information

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