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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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