Jump to content

Recommended Posts

Posted

Sorry for possibly another newbie question, but I'm having a little trouble with the first person rendering GL code.

The view below is largely lifted from the vanilla renderer's first person map section (needed for the arms).

However, when I run it, it renders no arms in the game view (screencap attached below.)

I've tried registering it at the same time as the item in preinit and at the same time as the tileentity renderer (visible in the screenshots) in init. Neither way appears to work.

I've check through the code and it's not coughing up any errors or warnings, so I'm getting more than a tad confused.

Is anything obviously wrong to anyone?

 

package emeraldCasino.renderers.items;

import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import emeraldCasino.items.itemCardHand;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;

@SideOnly(Side.CLIENT)
public class ItemCardHandRenderer implements IItemRenderer {
int itemRenderId;

public ItemCardHandRenderer() {
	itemRenderId = RenderingRegistry.getNextAvailableRenderId();
}

@Override
public boolean handleRenderType(ItemStack itemStack, ItemRenderType type) {
	return (type==EQUIPPED_FIRST_PERSON);
}


public void renderItemInFirstPerson(float par1)
{



	/*
	 * Vanilla Map Rendering -- to Modify
	 */
	float f1 = 1.0F;
	Minecraft minecraft = Minecraft.getMinecraft();
	EntityClientPlayerMP entityclientplayermp = minecraft.thePlayer;
	ResourceLocation deckTexture = new ResourceLocation(emeraldCasino.EmeraldCasino.MODID,"textures/cardDecks/deck_standard.png");
	float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * par1;
        
        	//GET PARENT GAME FROM HAND
        	//GET DECK TEXTURE FROM GAME
        	//BIND DECK TEXTURE FROM GAME
        	//GET CARDS & CARD DATA FROM HAND
        	
            GL11.glPushMatrix();
            float f13 = 0.8F;
            float swingProgress = entityclientplayermp.getSwingProgress(par1);
            float f6 = MathHelper.sin(swingProgress * (float)Math.PI);
            float f7 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI);
            GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F);
            swingProgress = 1.0F - f2 / 45.0F + 0.1F;

            if (swingProgress < 0.0F)
            {
                swingProgress = 0.0F;
            }

            if (swingProgress > 1.0F)
            {
                swingProgress = 1.0F;
            }

            swingProgress = -MathHelper.cos(swingProgress * (float)Math.PI) * 0.5F + 0.5F;
            GL11.glTranslatef(0.0F, 0.0F * f13 - (1.0F - f1) * 1.2F - swingProgress * 0.5F + 0.04F, -0.9F * f13);
            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(swingProgress * -85.0F, 0.0F, 0.0F, 1.0F);
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            minecraft.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());


		//RENDER CARD RECTS IN ARC -- INCREASE DISTANCE FROM ORIGIN FOR ACTIVE CARDS


            for (int i1 = 0; i1 < 2; ++i1)
            {
                int j1 = i1 * 2 - 1;
                GL11.glPushMatrix();
                GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float)j1);
                GL11.glRotatef((float)(-45 * j1), 1.0F, 0.0F, 0.0F);
                GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
                GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
                GL11.glRotatef((float)(-65 * j1), 0.0F, 1.0F, 0.0F);
                Render render = RenderManager.instance.getEntityRenderObject(entityclientplayermp);
                RenderPlayer renderplayer = (RenderPlayer)render;
                float f10 = 1.0F;
                GL11.glScalef(f10, f10, f10);
                renderplayer.renderFirstPersonArm(entityclientplayermp);
                GL11.glPopMatrix();
            }

            f6 = entityclientplayermp.getSwingProgress(par1);
            f7 = MathHelper.sin(f6 * f6 * (float)Math.PI);
            float f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI);
            GL11.glRotatef(-f7 * 20.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F);
            float f9 = 0.38F;
            GL11.glScalef(f9, f9, f9);
            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
            float f10 = 0.015625F;
            GL11.glScalef(f10, f10, f10);
            minecraft.getTextureManager().bindTexture(deckTexture);
            Tessellator tessellator = Tessellator.instance;
            GL11.glNormal3f(0.0F, 0.0F, -1.0F);
            tessellator.startDrawingQuads();
            byte b0 = 7;
            tessellator.addVertexWithUV((double)(0 - b0), (double)(128 + b0), 0.0D, 0.0D, 1.0D);
            tessellator.addVertexWithUV((double)(128 + b0), (double)(128 + b0), 0.0D, 1.0D, 1.0D);
            tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D);
            tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D);
            tessellator.draw();

            GL11.glPopMatrix();
       
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType arg0, ItemStack arg1,
		ItemRendererHelper arg2) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	// TODO Auto-generated method stub

}

}

 

Holding vanilla map:

34c6982b713d749a6913e2a3754326465de688f7.jpg

 

Holding card hand item:

91ef4ac771e838bbe5f75aa801484eb178e31cfe.jpg

 

 

Console output: (Note: the missing textures relate to the block and item assets, there's nothing in there about the player skin nor the deck_standard.png called in the renderer)

[14:52:27] [main/INFO]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[14:52:27] [main/INFO]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[14:52:27] [main/INFO]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker

[14:52:27] [main/INFO]: Forge Mod Loader version 7.2.211.1121 for Minecraft 1.7.2 loading

[14:52:27] [main/INFO]: Java is Java HotSpot 64-Bit Server VM, version 1.7.0_55, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

[14:52:27] [main/INFO]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[14:52:27] [main/INFO]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:52:27] [main/INFO]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker

[14:52:27] [main/INFO]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:52:27] [main/INFO]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:52:27] [main/INFO]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

[14:52:27] [main/ERROR]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[14:52:29] [main/ERROR]: The minecraft jar file:/C:/Users/forma1617/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.2.1121/forgeBin-1.7.2-10.12.2.1121.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!

[14:52:29] [main/ERROR]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!

[14:52:29] [main/ERROR]: Technical information: ClientBrandRetriever was at jar:file:/C:/Users/forma1617/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.2.1121/forgeBin-1.7.2-10.12.2.1121.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it

[14:52:29] [main/ERROR]: FML appears to be missing any signature data. This is not a good thing

[14:52:29] [main/INFO]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

[14:52:29] [main/INFO]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker

[14:52:29] [main/INFO]: Launching wrapped minecraft {net.minecraft.client.main.Main}

[14:52:35] [main/INFO]: Setting user: Minothor

[14:52:36] [Client thread/INFO]: LWJGL Version: 2.9.0

[14:52:37] [Client thread/INFO]: Attempting early MinecraftForge initialization

[14:52:37] [Client thread/INFO]: MinecraftForge v10.12.2.1121 Initialized

[14:52:37] [Client thread/INFO]: Replaced 182 ore recipies

[14:52:37] [Client thread/INFO]: Completed early MinecraftForge initialization

[14:52:37] [Client thread/INFO]: Searching S:\JAVASE\Etudiants\Nicholas\workspace\GitHub\EmeraldCasino\eclipse\mods for mods

[14:52:39] [Client thread/ERROR]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error.  There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW!

[14:52:39] [Client thread/ERROR]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.Start. This is generally a severe programming error.  There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW!

[14:52:40] [Client thread/INFO]: Forge Mod Loader has identified 4 mods to load

[14:52:42] [Client thread/ERROR]: The mod emeraldcasino appears to have an invalid event annotation EventHandler. This annotation can only apply to methods with recognized event arguments - it will not be called

[14:52:42] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Emerald Casino

[14:52:42] [Client thread/INFO]: Processing ObjectHolder annotations

[14:52:42] [Client thread/INFO]: Found 341 ObjectHolder annotations

[14:52:42] [Client thread/INFO]: Configured a dormant chunk cache size of 0

[14:52:42] [Client thread/INFO]: Applying holder lookups

[14:52:42] [Client thread/INFO]: Holder lookups applied

 

Starting up SoundSystem...

Initializing LWJGL OpenAL

    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

OpenAL initialized.

 

[14:52:43] [sound Library Loader/INFO]: Sound engine started

[14:52:46] [Client thread/ERROR]: Using missing texture, unable to load emeraldcasino:textures/blocks/CardDeckIcon.png

java.io.FileNotFoundException: emeraldcasino:textures/blocks/CardDeckIcon.png

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SourceFile:58) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:125) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:90) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(SourceFile:72) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(SourceFile:61) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(SourceFile:52) [TextureManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:523) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:815) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(SourceFile:103) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_55]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_55]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

[14:52:47] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

[14:52:47] [Client thread/ERROR]: Using missing texture, unable to load emeraldcasino:textures/items/CardDeck.png

java.io.FileNotFoundException: emeraldcasino:textures/items/CardDeck.png

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SourceFile:58) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:125) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:90) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(SourceFile:72) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(SourceFile:61) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(SourceFile:52) [TextureManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:524) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:815) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(SourceFile:103) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_55]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_55]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

[14:52:47] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[14:52:47] [Client thread/INFO]: Forge Mod Loader has successfully loaded 4 mods

[14:52:47] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Emerald Casino

[14:52:47] [Client thread/ERROR]: Using missing texture, unable to load emeraldcasino:textures/items/CardDeck.png

java.io.FileNotFoundException: emeraldcasino:textures/items/CardDeck.png

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SourceFile:58) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:125) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:90) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(SourceFile:72) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(SourceFile:136) [TextureManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SourceFile:104) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SourceFile:92) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:568) [Minecraft.class:?]

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:815) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(SourceFile:103) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_55]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_55]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

[14:52:47] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[14:52:47] [Client thread/ERROR]: Using missing texture, unable to load emeraldcasino:textures/blocks/CardDeckIcon.png

java.io.FileNotFoundException: emeraldcasino:textures/blocks/CardDeckIcon.png

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SourceFile:58) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:125) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:90) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(SourceFile:72) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(SourceFile:136) [TextureManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SourceFile:104) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SourceFile:92) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:568) [Minecraft.class:?]

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:815) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(SourceFile:103) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_55]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_55]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

[14:52:48] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

 

SoundSystem shutting down...

    Author: Paul Lamb, www.paulscode.com

 

 

Starting up SoundSystem...

Initializing LWJGL OpenAL

    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

OpenAL initialized.

 

[14:52:48] [sound Library Loader/INFO]: Sound engine started

[14:52:50] [MCO Availability Checker #1/ERROR]: Couldn't connect to Realms

[14:54:30] [server thread/INFO]: Starting integrated minecraft server version 1.7.2

[14:54:30] [server thread/INFO]: Generating keypair

[14:54:31] [server thread/INFO]: Injecting existing block and item data into this server instance

[14:54:31] [server thread/INFO]: Applying holder lookups

[14:54:31] [server thread/INFO]: Holder lookups applied

[14:54:31] [server thread/INFO]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@44dd79bd)

[14:54:31] [server thread/INFO]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@44dd79bd)

[14:54:31] [server thread/INFO]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@44dd79bd)

[14:54:31] [server thread/INFO]: Preparing start region for level 0

Tile Entity Created!

Tile Entity Created!

[14:54:32] [server thread/INFO]: Preparing spawn area: 67%

[14:54:33] [Netty Client IO #0/INFO]: Server protocol version 1

[14:54:33] [Netty IO #1/INFO]: Client protocol version 1

[14:54:33] [Netty IO #1/INFO]: Client attempting to join with 4 mods : [email protected] - 1.0.0,[email protected],[email protected],[email protected]

[14:54:33] [Netty IO #1/INFO]: Attempting connection with missing mods [] at CLIENT

[14:54:33] [Netty Client IO #0/INFO]: Attempting connection with missing mods [] at SERVER

[14:54:33] [server thread/INFO]: [server thread] Server side modded connection established

[14:54:33] [Client thread/INFO]: [Client thread] Client side modded connection established

[14:54:33] [server thread/INFO]: Minothor[local:E:f2b6fe3b] logged in with entity id 191 at (-255.81571177864868, 64.0, 120.09596504359467)

[14:54:33] [server thread/INFO]: Minothor joined the game

Tile Entity Created!

Tile Entity Created!

[14:54:34] [Client thread/WARN]: Failed to load texture: emeraldcasino:textures/blocks/tileDeck.png

java.io.FileNotFoundException: emeraldcasino:textures/blocks/tileDeck.png

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SourceFile:58) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SourceFile:29) ~[simpleTexture.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(SourceFile:72) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.bindTexture(SourceFile:40) [TextureManager.class:?]

at emeraldCasino.renderers.blocks.TileEntityCardBlockRenderer.renderTileEntityAt(TileEntityCardBlockRenderer.java:46) [TileEntityCardBlockRenderer.class:?]

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(SourceFile:100) [TileEntityRendererDispatcher.class:?]

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(SourceFile:92) [TileEntityRendererDispatcher.class:?]

at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:482) [RenderGlobal.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1214) [EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1011) [EntityRenderer.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:944) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:835) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(SourceFile:103) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_55]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_55]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

[14:54:54] [Client thread/INFO]: [CHAT] Saved screenshot as 2014-07-09_14.54.54.png

[14:55:08] [Client thread/INFO]: [CHAT] Saved screenshot as 2014-07-09_14.55.08.png

[14:55:11] [server thread/INFO]: Saving and pausing game...

[14:55:11] [server thread/INFO]: Saving chunks for level 'New World'/Overworld

[14:55:11] [server thread/INFO]: Saving chunks for level 'New World'/Nether

[14:55:11] [server thread/INFO]: Saving chunks for level 'New World'/The End

[14:55:20] [Client thread/INFO]: Stopping!

[14:55:21] [server thread/INFO]: Stopping server

[14:55:21] [server thread/INFO]: Saving players

 

SoundSystem shutting down...

[14:55:21] [server thread/INFO]: Saving worlds

[14:55:21] [server thread/INFO]: Saving chunks for level 'New World'/Overworld

[14:55:21] [server thread/INFO]: Saving chunks for level 'New World'/Nether

[14:55:21] [server thread/INFO]: Saving chunks for level 'New World'/The End

    Author: Paul Lamb, www.paulscode.com

 

[14:55:21] [server thread/INFO]: Unloading dimension 0

[14:55:21] [server thread/INFO]: Unloading dimension -1

[14:55:21] [server thread/INFO]: Unloading dimension 1

[14:55:21] [server thread/INFO]: Applying holder lookups

[14:55:21] [server thread/INFO]: Holder lookups applied

Posted

Hi Grey, I'm expecting it to be called when I have the card hand equipped in first person mode.

oddly enough, it renders a blank item in my hand in 3rd person view, which is expected, I leave that to the vanilla code, but in first person, I'm trying to have the map's two handed rendering come up, akin to Azanor's thaumometer rendering.

I'll admit that I'm glad you replied, it's been between vanilla code and your blog that I've made the little progress I have so far.

Posted

Hi

 

Unless I've misunderstood what you're trying to do, you will need to call renderItemInFirstPerson from your IItemRenderer.renderItem method, because nothing else in vanilla or forge will call it directly.

eg

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	// TODO Auto-generated method stub
           renderItemInFirstPerson(0.0F);
}

 

-TGG

Posted

Ah.. Cheers! That leaves me with the initial problem I was trying to overcome (and led to this one) of how you get the partialTickTime parameter for the first person view. I'd mistakenly believed that Minecraft itself would call the function with that parameter since the only details I could find in the forums here and Forums mentioned rendering being derpy if you pass a random value in that function instead of the actual time elapsed between ticks. (it was post dieselieben made that explained most.) but I couldn't find the pTT in entity, the minecraft instance or the RenderManager. If you're able to point me in the right direction, you have no bloody idea how grateful I'd be even for the name of Tue class.

Posted

Something like this works just fine.  Doesn't need the partialtick.

 

 

 

 

 

    @Override

    public boolean handleRenderType(ItemStack item, ItemRenderType type) {

   

        switch (type) {

       

            case EQUIPPED:

                return true;

 

            case EQUIPPED_FIRST_PERSON:

                return true;

 

            case INVENTORY:

                return true;

 

            default:

                return false;

               

        }

       

    }

 

@Override

    public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

   

        switch (type) {

       

            case EQUIPPED: {

           

            // Reset Rendering

                GL11.glPushMatrix();

 

                // Bind Texture

                Minecraft.getMinecraft().renderEngine.bindTexture(texture);

               

                // Rescale Texture

                float scale = 0.5F;               

                GL11.glScalef(scale, scale, scale);

               

                // Rotate Y

                GL11.glRotatef(15, 0.0F, 1.0F, 0.0F);

 

                // Rotate X

                GL11.glRotatef(180 + 15, 1.0F, 0.0F, 0.0F);

               

                // Rotate z

                GL11.glRotatef(-15, 0.0F, 0.0F, 1.0F);

 

                // Move to correct position

                GL11.glTranslatef(0.85F, 0.0F, 0.05F); // Left-Right Forward-Backwards Up-Down

 

                // Render Model

                hammer.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

               

                // Check for WarHammer Raptor

                if (charged && instance.functions_common().random().nextInt(lightningChance) == 0) raptor_flash((Entity) data[1]);

                               

                // Finish Rendering

                GL11.glPopMatrix();

               

               

               

                break;

            }

         

            case EQUIPPED_FIRST_PERSON: {

           

            // Reset Rendering

                GL11.glPushMatrix();

 

                // Bind Texture

                Minecraft.getMinecraft().renderEngine.bindTexture(texture);

               

                // Rescale Texture

                float scale = 0.5F;               

                GL11.glScalef(scale, scale, scale);

               

                // Rotate Y

                GL11.glRotatef(90 + 15, 0.0F, 1.0F, 0.0F);

 

                // Rotate X

                GL11.glRotatef(180 + 15, 1.0F, 0.0F, 0.0F);

               

                // Rotate z

                GL11.glRotatef(-15, 0.0F, 0.0F, 1.0F);

 

                // Move to correct position

                //GL11.glTranslatef(0.85F, 0.0F, 0.05F); // Left-Right Forward-Backwards Up-Down

 

                // Render Model

                hammer.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

               

                // Check for WarHammer Raptor

                if (charged && instance.functions_common().random().nextInt(lightningChance) == 0) raptor_flash((Entity) data[1]);

               

                // Finish Rendering

                GL11.glPopMatrix();

           

                break;

            }

 

            case INVENTORY: {

           

            // Reset Rendering

                GL11.glPushMatrix();

               

                // Setup OpenGL

    GL11.glEnable(GL11.GL_ALPHA_TEST);

           

            // Setup Render

                RenderItem renderItem = new RenderItem();

               

                // set Texture

                IIcon icon = item.getIconIndex();

               

                // Enable Blending

                //GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

               

                // Render

                renderItem.renderIcon(0, 0, icon, 16, 16);

               

                // Undo;

                //GL11.glDisable(GL11.GL_BLEND);

               

                // Finish Rendering

                GL11.glPopMatrix();

               

                break;

               

            }

 

            default:

           

                break;

               

        }

       

    }

 

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Ah.. Cheers! That leaves me with the initial problem I was trying to overcome (and led to this one) of how you get the partialTickTime parameter for the first person view. I'd mistakenly believed that Minecraft itself would call the function with that parameter since the only details I could find in the forums here and Forums mentioned rendering being derpy if you pass a random value in that function instead of the actual time elapsed between ticks. (it was post dieselieben made that explained most.) but I couldn't find the pTT in entity, the minecraft instance or the RenderManager. If you're able to point me in the right direction, you have no bloody idea how grateful I'd be even for the name of Tue class.

No worries

 

FYI partialTick is only there to help make your animations smoother.

Minecraft ticks 20 times per second but can render many more frames per second than that.

 

Let's say your renderer is called 80 times per second.

First call: (tick = 0) , partialTick = 0.0

Second call: (tick = 0) , partialTick = 0.25

Third call: (tick = 0) , partialTick = 0.50

Fourth call: (tick = 0) , partialTick = 0.75

Fifth call: (tick = 1) , partialTick = 0.0

etc.

 

So if you don't have it, just choose a number and stick with it.  The animations / moving hands / objects etc (if any) will be a bit jerkier but that's all.

 

-TGG

 

 

 

 

 

 

 

Posted

Cheers all,

and grey, I have a little question about the GL11 translate and rotate functions.

I've been trying with modifying invidual parametres, but the translation along the X,Y&Z axes seems totally arbitrary. as far as I can tell, the Y value if how close or far from the player it's rendered towards the centre of the screen, but the other two seem to lack consistency in their translations, usually some variation of off the top of the screen or some vertical change, regardless of the value changed being X or Z. This has been compounded by the fact that so far, even the documentation I've found so far is suggesting that the function should work as expected.

Could you possibly shed any light on the matter?

Many Thanks in advance.

(p.s. asking here rather than in PM in case others happen to be searching the forums for a similar issue)

Posted

Hi

 

The effect of GL11.glTranslate depends on how the caller has set things up.  Sometimes (eg with GUI) the x, y are the left/right and up/down on the screen, with z being the depth.

Sometimes, they are aligned with the east/west, up/down, north/south in the world.  Sometimes they're aligned with an object - for example for items held in the player's hand, or the map, or similar.

 

In case you're not up to speed with OpenGL yet, this book is very useful for coming to grips with OpenGL (although it's a bit hard to follow in places)

http://www.glprogramming.com/red/

The part on transformations is here

http://www.glprogramming.com/red/chapter03.html

 

I have to admit I often struggle to get the transformation right if it's not something simple.  I usually wind up with trial and error of a combination of rotate and translate to get a mental picture of how the axes are sitting relative to what I want, and then figuring out what the correct rotate and translate should be.

 

-TGG

 

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



×
×
  • Create New...

Important Information

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