Jump to content

Recommended Posts

Posted

Hello,

I have recently gotten back into modding and started making a mod that adds a new way to craft.  But I have run into the issue that, with the current method, the player cannot actual view the items in the container.  So my question is how can I display the items in the block like the item frame does?  I have looked at RenderItemFrame.doRender but im not sure how to implement it to work with a block.  I hope that made sense.

 

Thanks in advanced!

Posted

Here is what i have trie from the wiki mixed with the RenderItemFrame class, i commented out code that i believe i dont need at the moment.

 

Edit: Changed it to what the wiki suggests(modified slightly):

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z,
		float partialTicks, int destroyStage) {
    // locationBlocksTexture is a "ResourceLocation" that points to a texture made of many block "icons".
    // It will look very ugly, but creating our own ResourceLocation is beyond the scope of this tutorial.
    this.bindTexture(TextureMap.locationBlocksTexture);

    Tessellator tessellator = Tessellator.getInstance();
    GL11.glPushMatrix();
    GL11.glTranslated(x, y+1, z); // +1 so that our "drawing" appears 1 block over our block (to get a better view)
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0, 0, 0, 0, 0);
    tessellator.addVertexWithUV(0, 1, 0, 0, 1);
    tessellator.addVertexWithUV(1, 1, 0, 1, 1);
    tessellator.addVertexWithUV(1, 0, 0, 1, 0);

    tessellator.addVertexWithUV(0, 0, 0, 0, 0);
    tessellator.addVertexWithUV(1, 0, 0, 1, 0);
    tessellator.addVertexWithUV(1, 1, 0, 1, 1);
    tessellator.addVertexWithUV(0, 1, 0, 0, 1);

    tessellator.draw();
    GL11.glPopMatrix();
}

Posted

I believe i understand most of it but i cant tell you exactly how it works:

 

 

 

Tessellator tessellator = Tessellator.getInstance();

This line is creating an instance of tessellator.

 

tessellator.startDrawingQuads();

Tells tesselator you want to start drawing quads, a four vertex shape.

 

tessellator.addVertexWithUV(0, 0, 0, 0, 0);

Adds a vertex, the first 3 variables states the position(x,y,z) and the next 2 are the uv corrdinates(x,y/u,v).

 

tessellator.draw();

Tells the tesselator to draw the specified quads.

 

Edit forgot this part:

this.bindTexture(TextureMap.locationBlocksTexture);

Binds the texture to be used during rendering of the following quads.

 

 

Posted

My issue is that

tessellator.startDrawingQuads();

and

tessellator.addVertexWithUV(0, 0, 0, 0, 0);

give errors.  They give a "The method [name] is undefined for the type Tesselator".  I know this means the method no longer exists.  So my question is what is the equivalent to this/should i use a new approach, if so what.

Posted

They appear to not be in there either.  I get errors on the same lines and cant find anything in that class that could be an equivalent to those methods.  Am I doing something wrong? 

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z,
		float partialTicks, int destroyStage) {
    // locationBlocksTexture is a "ResourceLocation" that points to a texture made of many block "icons".
    // It will look very ugly, but creating our own ResourceLocation is beyond the scope of this tutorial.
    this.bindTexture(TextureMap.locationBlocksTexture);
    
    WorldRenderer worldRenderer = new WorldRenderer((256));
    GL11.glPushMatrix();
    GL11.glTranslated(x, y+1, z); // +1 so that our "drawing" appears 1 block over our block (to get a better view)
    worldRenderer.startDrawingQuads();
    worldRenderer.addVertexWithUV(0, 0, 0, 0, 0);
    worldRenderer.addVertexWithUV(0, 1, 0, 0, 1);
    worldRenderer.addVertexWithUV(1, 1, 0, 1, 1);
    worldRenderer.addVertexWithUV(1, 0, 0, 1, 0);

    worldRenderer.addVertexWithUV(0, 0, 0, 0, 0);
    worldRenderer.addVertexWithUV(1, 0, 0, 1, 0);
    worldRenderer.addVertexWithUV(1, 1, 0, 1, 1);
    worldRenderer.addVertexWithUV(0, 1, 0, 0, 1);

    worldRenderer.draw();
    GL11.glPopMatrix();
}

Posted

Well, I know that startDrawingQuads(); changed to startDrawing(7); (IIRC.  Also, the 7 is the integer value of.... GL11.GL_QUADS if I got that right).

 

Now, look inside the WorldRenderer class and see if you can find the name for the other method yourself.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well I believe I found the methods but when i add that second vertex(call putPosition the second time) it crashes and throws an index out of bounds exception

 

My code:

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z,
		float partialTicks, int destroyStage) {
    this.bindTexture(TextureMap.locationBlocksTexture);
    
    WorldRenderer worldRenderer = new WorldRenderer(256);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y+1, z); // +1 so that our "drawing" appears 1 block over our block (to get a better view);
    
    VertexFormat vf = new VertexFormat();
    
    worldRenderer.begin(GL11.GL_QUADS, vf);
    worldRenderer.putPosition(0, 0, 0);
    worldRenderer.putPosition(1, 0, 0);
    worldRenderer.putPosition(1, 0, 1);
    worldRenderer.putPosition(0, 0, 1);
    
    worldRenderer.addVertexData(new int[]{0, 1, 2, 2, 3, 0});
    worldRenderer.finishDrawing();
    GL11.glPopMatrix();
}

 

Error:

 

2016-02-23 15:29:45,463 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-02-23 15:29:45,466 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

[15:29:45] [main/INFO] [GradleStart]: Extra: []

[15:29:45] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/ACCOUNT/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken{REDACTED}, --version, 1.8.9, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]

[15:29:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[15:29:45] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[15:29:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker

[15:29:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker

[15:29:45] [main/INFO] [FML]: Forge Mod Loader version 11.15.1.1756 for Minecraft 1.8.9 loading

[15:29:45] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.8.0_71, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre1.8.0_71

[15:29:45] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[15:29:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker

[15:29:45] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin

[15:29:45] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin

[15:29:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[15:29:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[15:29:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[15:29:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[15:29:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[15:29:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

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

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

[15:29:47] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[15:29:47] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[15:29:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[15:29:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker

[15:29:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker

[15:29:48] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

2016-02-23 15:29:48,767 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-02-23 15:29:48,803 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-02-23 15:29:48,808 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

[15:29:49] [Client thread/INFO]: Setting user: Player597

[15:29:53] [Client thread/INFO]: LWJGL Version: 2.9.4

[15:29:53] [Client thread/WARN] [FML]: =============================================================

[15:29:53] [Client thread/WARN] [FML]: MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!

[15:29:53] [Client thread/WARN] [FML]: Offendor: com/sun/jna/Native.main([Ljava/lang/String;)V

[15:29:53] [Client thread/WARN] [FML]: Use FMLCommonHandler.exitJava instead

[15:29:53] [Client thread/WARN] [FML]: =============================================================

[15:29:53] [Client thread/INFO] [sTDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:246]: ---- Minecraft Crash Report ----

// Shall we play a game?

 

Time: 2/23/16 3:29 PM

Description: Loading screen debug info

 

This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.8.9

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.8.0_71, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 821071136 bytes (783 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML:

Loaded coremods (and transformers):

GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.3316' Renderer: 'Intel® HD Graphics 2500'

[15:29:53] [Client thread/INFO] [FML]: MinecraftForge v11.15.1.1756 Initialized

[15:29:54] [Client thread/INFO] [FML]: Replaced 204 ore recipies

[15:29:54] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer

[15:29:54] [Client thread/INFO] [FML]: Searching C:\Users\ACCOUNT\Desktop\Minecraft\Modding\Alchemy\run\mods for mods

[15:29:55] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[15:29:56] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, alchemy] at CLIENT

[15:29:56] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, alchemy] at SERVER

[15:29:57] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Alchemy

[15:29:57] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[15:29:57] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations

[15:29:57] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations

[15:29:57] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations

[15:29:57] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[15:29:57] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json

[15:29:57] [Client thread/INFO] [FML]: Applying holder lookups

[15:29:57] [Client thread/INFO] [FML]: Holder lookups applied

[15:29:57] [Client thread/INFO] [FML]: Injecting itemstacks

[15:29:57] [Client thread/INFO] [FML]: Itemstack injection complete

[15:29:57] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Found status: OUTDATED Target: 11.15.1.1761

[15:29:57] [sound Library Loader/INFO]: Starting up SoundSystem...

[15:29:57] [Thread-9/INFO]: Initializing LWJGL OpenAL

[15:29:57] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[15:29:57] [Thread-9/INFO]: OpenAL initialized.

[15:29:58] [sound Library Loader/INFO]: Sound engine started

[15:30:04] [Client thread/INFO] [FML]: Max texture size: 8192

[15:30:04] [Client thread/INFO]: Created: 16x16 textures-atlas

[15:30:05] [Client thread/ERROR] [FML]: Model definition for location alchemy:wooden_cauldron#normal not found

[15:30:05] [Client thread/INFO] [FML]: Injecting itemstacks

[15:30:05] [Client thread/INFO] [FML]: Itemstack injection complete

[15:30:05] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[15:30:05] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Alchemy

[15:30:05] [Client thread/INFO]: SoundSystem shutting down...

[15:30:06] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[15:30:06] [sound Library Loader/INFO]: Starting up SoundSystem...

[15:30:06] [Thread-11/INFO]: Initializing LWJGL OpenAL

[15:30:06] [Thread-11/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[15:30:06] [Thread-11/INFO]: OpenAL initialized.

[15:30:06] [sound Library Loader/INFO]: Sound engine started

[15:30:11] [Client thread/INFO] [FML]: Max texture size: 8192

[15:30:12] [Client thread/INFO]: Created: 512x512 textures-atlas

[15:30:12] [Client thread/ERROR] [FML]: Model definition for location alchemy:wooden_cauldron#normal not found

[15:30:13] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[15:30:16] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[15:30:16] [server thread/INFO]: Starting integrated minecraft server version 1.8.9

[15:30:16] [server thread/INFO]: Generating keypair

[15:30:16] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance

[15:30:16] [server thread/INFO] [FML]: Applying holder lookups

[15:30:16] [server thread/INFO] [FML]: Holder lookups applied

[15:30:16] [server thread/INFO] [FML]: Loading dimension 0 (Test) (net.minecraft.server.integrated.IntegratedServer@3cfa752)

[15:30:16] [server thread/INFO] [FML]: Loading dimension 1 (Test) (net.minecraft.server.integrated.IntegratedServer@3cfa752)

[15:30:16] [server thread/INFO] [FML]: Loading dimension -1 (Test) (net.minecraft.server.integrated.IntegratedServer@3cfa752)

[15:30:16] [server thread/INFO]: Preparing start region for level 0

[15:30:17] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[15:30:17] [server thread/INFO]: Changing view distance to 8, from 10

[15:30:19] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2

[15:30:19] [Netty Server IO #1/INFO] [FML]: Client protocol version 2

[15:30:19] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : [email protected],[email protected],[email protected],[email protected]

[15:30:19] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established

[15:30:19] [server thread/INFO] [FML]: [server thread] Server side modded connection established

[15:30:19] [server thread/INFO]: Player597[local:E:8d107688] logged in with entity id 334 at (-429.82011185580535, 4.0, -283.1662163917155)

[15:30:19] [server thread/INFO]: Player597 joined the game

[15:30:21] [server thread/INFO]: Stopping server

[15:30:21] [server thread/INFO]: Saving players

[15:30:21] [server thread/INFO]: Saving worlds

[15:30:21] [server thread/INFO]: Saving chunks for level 'Test'/Overworld

[15:30:21] [server thread/INFO]: Saving chunks for level 'Test'/Nether

[15:30:21] [server thread/INFO]: Saving chunks for level 'Test'/The End

[15:30:21] [server thread/INFO] [FML]: Unloading dimension 0

[15:30:21] [server thread/INFO] [FML]: Unloading dimension -1

[15:30:21] [server thread/INFO] [FML]: Unloading dimension 1

[15:30:21] [server thread/INFO] [FML]: Applying holder lookups

[15:30:22] [server thread/INFO] [FML]: Holder lookups applied

[15:30:22] [Client thread/FATAL]: Reported exception thrown!

net.minecraft.util.ReportedException: Rendering Block Entity

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:149) ~[TileEntityRendererDispatcher.class:?]

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:117) ~[TileEntityRendererDispatcher.class:?]

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

at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1369) ~[EntityRenderer.class:?]

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

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

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

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

at net.minecraft.client.main.Main.main(Main.java:116) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

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

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_71]

at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_71]

at net.minecraft.client.renderer.vertex.VertexFormat.getElement(VertexFormat.java:170) ~[VertexFormat.class:?]

at net.minecraft.client.renderer.WorldRenderer.begin(WorldRenderer.java:193) ~[WorldRenderer.class:?]

at com.drok0920.alchemy.tileentityrenderer.CauldronRenderer.renderTileEntityAt(CauldronRenderer.java:25) ~[CauldronRenderer.class:?]

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:142) ~[TileEntityRendererDispatcher.class:?]

... 20 more

[15:30:22] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:612]: ---- Minecraft Crash Report ----

// Sorry :(

 

Time: 2/23/16 3:30 PM

Description: Rendering Block Entity

 

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

at java.util.ArrayList.rangeCheck(Unknown Source)

at java.util.ArrayList.get(Unknown Source)

at net.minecraft.client.renderer.vertex.VertexFormat.getElement(VertexFormat.java:170)

at net.minecraft.client.renderer.WorldRenderer.begin(WorldRenderer.java:193)

at com.drok0920.alchemy.tileentityrenderer.CauldronRenderer.renderTileEntityAt(CauldronRenderer.java:25)

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:142)

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:117)

at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:698)

at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1369)

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1283)

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1111)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107)

at net.minecraft.client.Minecraft.run(Minecraft.java:380)

at net.minecraft.client.main.Main.main(Main.java:116)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

at GradleStart.main(GradleStart.java:26)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at java.util.ArrayList.rangeCheck(Unknown Source)

at java.util.ArrayList.get(Unknown Source)

at net.minecraft.client.renderer.vertex.VertexFormat.getElement(VertexFormat.java:170)

at net.minecraft.client.renderer.WorldRenderer.begin(WorldRenderer.java:193)

at com.drok0920.alchemy.tileentityrenderer.CauldronRenderer.renderTileEntityAt(CauldronRenderer.java:25)

 

-- Block Entity Details --

Details:

Name: alchemyCauldron // com.drok0920.alchemy.tileentity.CauldronTileEntity

Block type: ID #198 (tile.wooden_cauldron // com.drok0920.alchemy.blocks.WoodenCauldronBlock)

Block data value: 0 / 0x0 / 0b0000

Block location: World: (-430,4,-286), Chunk: (at 2,0,2 in -27,-18; contains blocks -432,0,-288 to -417,255,-273), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)

Actual block type: ID #198 (tile.wooden_cauldron // com.drok0920.alchemy.blocks.WoodenCauldronBlock)

Actual block data value: 0 / 0x0 / 0b0000

Stacktrace:

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:142)

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:117)

at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:698)

at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1369)

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1283)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityPlayerSP['Player597'/334, l='MpServer', x=-429.82, y=4.00, z=-283.17]]

Chunk stats: MultiplayerChunkCache: 210, 210

Level seed: 0

Level generator: ID 01 - flat, ver 0. Features enabled: false

Level generator options:

Level spawn location: -386.00,4.00,-258.00 - World: (-386,4,-258), Chunk: (at 14,0,14 in -25,-17; contains blocks -400,0,-272 to -385,255,-257), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)

Level time: 31132 game time, 6118 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 135 total; [EntitySlime['Slime'/17, l='MpServer', x=-502.56, y=5.00, z=-359.53], EntityPig['Pig'/18, l='MpServer', x=-496.09, y=4.00, z=-298.28], EntitySlime['Slime'/19, l='MpServer', x=-508.31, y=4.00, z=-284.25], EntitySlime['Slime'/22, l='MpServer', x=-508.81, y=4.00, z=-260.59], EntitySlime['Slime'/23, l='MpServer', x=-504.00, y=4.00, z=-263.69], EntitySlime['Slime'/24, l='MpServer', x=-509.69, y=4.00, z=-253.06], EntitySlime['Slime'/29, l='MpServer', x=-488.13, y=5.16, z=-362.38], EntitySlime['Slime'/30, l='MpServer', x=-488.25, y=4.00, z=-344.97], EntityChicken['Chicken'/31, l='MpServer', x=-495.13, y=4.00, z=-294.75], EntityPig['Pig'/32, l='MpServer', x=-480.09, y=4.00, z=-294.03], EntityChicken['Chicken'/33, l='MpServer', x=-487.28, y=4.00, z=-259.84], EntityItem['item.item.egg'/34, l='MpServer', x=-487.19, y=4.00, z=-258.94], EntityPig['Pig'/35, l='MpServer', x=-489.84, y=4.00, z=-241.41], EntityPlayerSP['Player597'/334, l='MpServer', x=-429.82, y=4.00, z=-283.17], EntityChicken['Chicken'/50, l='MpServer', x=-467.34, y=4.00, z=-348.59], EntitySlime['Slime'/51, l='MpServer', x=-464.66, y=4.00, z=-348.44], EntitySlime['Slime'/52, l='MpServer', x=-468.78, y=4.41, z=-330.81], EntitySheep['Sheep'/53, l='MpServer', x=-473.47, y=4.00, z=-284.47], EntityPig['Pig'/54, l='MpServer', x=-475.16, y=4.00, z=-275.28], EntityItem['item.item.egg'/55, l='MpServer', x=-465.06, y=4.00, z=-272.44], EntityChicken['Chicken'/56, l='MpServer', x=-464.72, y=4.00, z=-280.59], EntityPig['Pig'/57, l='MpServer', x=-471.06, y=4.00, z=-287.06], EntitySheep['Sheep'/58, l='MpServer', x=-470.75, y=4.00, z=-267.88], EntitySheep['Sheep'/59, l='MpServer', x=-468.34, y=4.00, z=-264.19], EntityChicken['Chicken'/60, l='MpServer', x=-476.88, y=4.00, z=-244.88], EntityItem['item.item.egg'/61, l='MpServer', x=-475.59, y=4.00, z=-243.94], EntityCow['Cow'/62, l='MpServer', x=-467.19, y=4.00, z=-206.00], EntityCow['Cow'/88, l='MpServer', x=-451.88, y=4.00, z=-363.16], EntityChicken['Chicken'/89, l='MpServer', x=-460.44, y=4.00, z=-356.34], EntitySlime['Slime'/90, l='MpServer', x=-449.53, y=5.16, z=-335.38], EntitySlime['Slime'/91, l='MpServer', x=-459.44, y=4.47, z=-347.69], EntityRabbit['Rabbit'/92, l='MpServer', x=-451.94, y=4.31, z=-340.44], EntitySlime['Slime'/93, l='MpServer', x=-453.47, y=4.00, z=-330.44], EntityPig['Pig'/94, l='MpServer', x=-459.38, y=4.00, z=-305.88], EntityVillager['Villager'/95, l='MpServer', x=-450.78, y=5.00, z=-304.38], EntityVillager['Villager'/96, l='MpServer', x=-444.84, y=4.00, z=-294.53], EntityVillager['Villager'/97, l='MpServer', x=-462.31, y=4.00, z=-298.53], EntitySlime['Slime'/98, l='MpServer', x=-454.56, y=6.22, z=-303.41], EntitySlime['Slime'/99, l='MpServer', x=-454.50, y=5.47, z=-275.78], EntitySlime['Slime'/100, l='MpServer', x=-451.56, y=4.09, z=-283.72], EntityVillager['Villager'/101, l='MpServer', x=-448.81, y=4.00, z=-267.41], EntityPig['Pig'/102, l='MpServer', x=-459.38, y=4.00, z=-260.84], EntitySlime['Slime'/103, l='MpServer', x=-456.34, y=4.00, z=-250.56], EntityRabbit['Rabbit'/104, l='MpServer', x=-453.44, y=4.00, z=-214.44], EntityCow['Cow'/105, l='MpServer', x=-462.91, y=4.00, z=-213.16], EntityChicken['Chicken'/130, l='MpServer', x=-439.06, y=4.00, z=-363.03], EntitySheep['Sheep'/132, l='MpServer', x=-448.00, y=4.00, z=-362.97], EntityRabbit['Rabbit'/134, l='MpServer', x=-437.88, y=4.00, z=-352.69], EntitySlime['Slime'/135, l='MpServer', x=-438.78, y=4.00, z=-364.75], EntitySlime['Slime'/136, l='MpServer', x=-448.22, y=4.00, z=-356.41], EntitySlime['Slime'/137, l='MpServer', x=-445.50, y=4.00, z=-345.41], EntitySheep['Sheep'/138, l='MpServer', x=-444.59, y=4.00, z=-350.09], EntitySlime['Slime'/139, l='MpServer', x=-446.63, y=4.00, z=-337.81], EntitySkeleton['Skeleton'/140, l='MpServer', x=-437.16, y=5.00, z=-318.59], EntitySlime['Slime'/141, l='MpServer', x=-443.03, y=4.00, z=-321.84], EntitySlime['Slime'/142, l='MpServer', x=-443.75, y=4.78, z=-332.75], EntityItem['item.item.bread'/143, l='MpServer', x=-437.88, y=5.00, z=-304.88], EntityVillager['Villager'/144, l='MpServer', x=-433.47, y=5.00, z=-318.06], EntityVillager['Villager'/145, l='MpServer', x=-444.50, y=5.00, z=-319.22], EntitySlime['Slime'/146, l='MpServer', x=-447.03, y=4.00, z=-304.06], EntitySlime['Slime'/147, l='MpServer', x=-442.53, y=3.41, z=-298.28], EntityVillager['Villager'/148, l='MpServer', x=-442.47, y=4.00, z=-295.72], EntityVillager['Villager'/149, l='MpServer', x=-447.28, y=5.00, z=-292.34], EntityVillager['Villager'/150, l='MpServer', x=-442.53, y=4.00, z=-293.38], EntityVillager['Villager'/151, l='MpServer', x=-444.34, y=4.00, z=-292.94], EntityVillager['Villager'/152, l='MpServer', x=-443.44, y=4.00, z=-294.06], EntityVillager['Villager'/153, l='MpServer', x=-437.16, y=5.00, z=-302.63], EntitySlime['Slime'/154, l='MpServer', x=-441.09, y=4.00, z=-287.88], EntityVillager['Villager'/155, l='MpServer', x=-440.47, y=4.00, z=-283.56], EntityVillager['Villager'/156, l='MpServer', x=-442.53, y=5.00, z=-280.22], EntityVillager['Villager'/157, l='MpServer', x=-444.53, y=4.00, z=-274.94], EntitySlime['Slime'/158, l='MpServer', x=-435.84, y=5.00, z=-285.75], EntityVillager['Villager'/159, l='MpServer', x=-437.44, y=4.00, z=-285.94], EntityVillager['Villager'/160, l='MpServer', x=-436.44, y=5.00, z=-258.84], EntityChicken['Chicken'/161, l='MpServer', x=-437.94, y=4.00, z=-263.78], EntityItem['item.item.egg'/162, l='MpServer', x=-437.66, y=4.00, z=-264.44], EntityPig['Pig'/163, l='MpServer', x=-437.50, y=4.00, z=-253.63], EntityRabbit['Rabbit'/164, l='MpServer', x=-435.16, y=4.00, z=-252.06], EntityRabbit['Rabbit'/165, l='MpServer', x=-437.84, y=4.00, z=-234.84], EntitySlime['Slime'/166, l='MpServer', x=-448.41, y=4.00, z=-217.50], EntityPig['Pig'/167, l='MpServer', x=-433.25, y=4.00, z=-216.75], EntityChicken['Chicken'/168, l='MpServer', x=-433.31, y=4.00, z=-217.75], EntitySlime['Slime'/183, l='MpServer', x=-425.28, y=4.00, z=-355.03], EntityRabbit['Rabbit'/185, l='MpServer', x=-432.28, y=4.19, z=-353.84], EntitySlime['Slime'/186, l='MpServer', x=-421.66, y=5.00, z=-337.72], EntityItem['item.item.seeds'/187, l='MpServer', x=-420.56, y=5.00, z=-326.31], EntityItem['item.item.carrots'/188, l='MpServer', x=-417.50, y=5.00, z=-328.19], EntityItem['item.item.carrots'/189, l='MpServer', x=-416.84, y=5.00, z=-334.19], EntityItem['item.item.carrots'/190, l='MpServer', x=-421.22, y=5.00, z=-324.28], EntityItem['item.item.carrots'/191, l='MpServer', x=-419.63, y=5.00, z=-334.25], EntityItem['item.item.seeds'/192, l='MpServer', x=-420.81, y=4.00, z=-306.28], EntityVillager['Villager'/193, l='MpServer', x=-423.50, y=5.00, z=-309.31], EntityItem['item.item.seeds'/194, l='MpServer', x=-425.53, y=5.00, z=-292.78], EntityItem['item.item.seeds'/195, l='MpServer', x=-417.22, y=5.00, z=-303.88], EntityItem['item.item.seeds'/196, l='MpServer', x=-422.34, y=5.00, z=-295.16], EntityItem['item.item.potato'/197, l='MpServer', x=-416.97, y=5.00, z=-290.53], EntityItem['item.item.potato'/198, l='MpServer', x=-417.41, y=5.00, z=-293.63], EntityItem['item.item.seeds'/199, l='MpServer', x=-416.81, y=5.00, z=-296.72], EntityItem['item.item.seeds'/200, l='MpServer', x=-422.13, y=5.00, z=-291.53], EntityItem['item.item.seeds'/201, l='MpServer', x=-420.31, y=5.00, z=-290.91], EntitySheep['Sheep'/202, l='MpServer', x=-416.78, y=5.00, z=-303.75], EntityItem['item.item.seeds'/203, l='MpServer', x=-419.84, y=5.00, z=-303.47], EntitySlime['Slime'/204, l='MpServer', x=-422.75, y=5.41, z=-304.50], EntityItem['item.item.seeds'/205, l='MpServer', x=-422.66, y=4.00, z=-283.63], EntitySlime['Slime'/206, l='MpServer', x=-424.72, y=4.00, z=-274.50], EntityItem['item.item.seeds'/207, l='MpServer', x=-418.72, y=5.00, z=-284.66], EntityItem['item.item.seeds'/208, l='MpServer', x=-421.00, y=4.00, z=-283.13], EntityItem['item.item.seeds'/209, l='MpServer', x=-416.94, y=5.00, z=-271.91], EntityVillager['Villager'/210, l='MpServer', x=-431.56, y=5.50, z=-268.94], EntityPig['Pig'/211, l='MpServer', x=-421.00, y=5.00, z=-252.16], EntityVillager['Villager'/212, l='MpServer', x=-419.56, y=5.00, z=-252.84], EntityVillager['Villager'/213, l='MpServer', x=-420.00, y=5.00, z=-255.88], EntityItem['item.item.bread'/214, l='MpServer', x=-421.88, y=4.00, z=-254.13], EntityChicken['Chicken'/215, l='MpServer', x=-418.31, y=4.00, z=-250.63], EntityRabbit['Rabbit'/216, l='MpServer', x=-425.91, y=4.00, z=-236.56], EntityRabbit['Rabbit'/217, l='MpServer', x=-417.59, y=4.00, z=-234.59], EntitySlime['Slime'/225, l='MpServer', x=-409.84, y=4.00, z=-362.91], EntityItem['item.item.carrots'/227, l='MpServer', x=-409.78, y=5.00, z=-322.38], EntityItem['item.item.carrots'/228, l='MpServer', x=-415.63, y=5.00, z=-331.53], EntityItem['item.item.carrots'/229, l='MpServer', x=-408.25, y=5.00, z=-318.88], EntityItem['item.item.seeds'/230, l='MpServer', x=-406.69, y=5.00, z=-311.66], EntityVillager['Villager'/231, l='MpServer', x=-407.56, y=4.00, z=-304.31], EntityItem['item.item.seeds'/232, l='MpServer', x=-415.81, y=5.00, z=-297.63], EntityItem['item.item.seeds'/233, l='MpServer', x=-407.03, y=4.00, z=-283.59], EntityItem['item.item.egg'/234, l='MpServer', x=-414.03, y=4.00, z=-245.03], EntityItem['item.item.egg'/235, l='MpServer', x=-412.13, y=4.00, z=-243.94], EntityRabbit['Rabbit'/236, l='MpServer', x=-401.78, y=4.00, z=-226.94], EntityChicken['Chicken'/237, l='MpServer', x=-413.44, y=4.00, z=-235.72], EntitySheep['Sheep'/240, l='MpServer', x=-385.16, y=4.00, z=-313.19], EntitySlime['Slime'/241, l='MpServer', x=-389.84, y=4.00, z=-282.22], EntitySlime['Slime'/244, l='MpServer', x=-387.50, y=4.00, z=-292.31], EntitySlime['Slime'/245, l='MpServer', x=-381.22, y=4.00, z=-288.34], EntitySlime['Slime'/246, l='MpServer', x=-373.28, y=4.00, z=-274.06], EntitySlime['Slime'/247, l='MpServer', x=-353.78, y=4.00, z=-330.78], EntitySlime['Slime'/252, l='MpServer', x=-355.28, y=4.00, z=-316.75]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:383)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2645)

at net.minecraft.client.Minecraft.run(Minecraft.java:401)

at net.minecraft.client.main.Main.main(Main.java:116)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

at GradleStart.main(GradleStart.java:26)

 

-- System Details --

Details:

Minecraft Version: 1.8.9

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.8.0_71, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 737247704 bytes (703 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP 9.19 Powered by Forge 11.15.1.1756 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8.9-11.15.1.1756.jar)

UCHIJAAAA Forge{11.15.1.1756} [Minecraft Forge] (forgeSrc-1.8.9-11.15.1.1756.jar)

UCHIJAAAA alchemy{0.0.1} [Alchemy] (bin)

Loaded coremods (and transformers):

GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.3316' Renderer: 'Intel® HD Graphics 2500'

Launched Version: 1.8.9

LWJGL: 2.9.4

OpenGL: Intel® HD Graphics 2500 GL version 4.0.0 - Build 10.18.10.3316, Intel

GL Caps: Using GL 1.3 multitexturing.

Using GL 1.3 texture combiners.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Shaders are available because OpenGL 2.1 is supported.

VBOs are available because OpenGL 1.5 is supported.

 

Using VBOs: No

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs:

Current Language: English (US)

Profiler Position: N/A (disabled)

CPU: 4x Intel® Core i5-3330 CPU @ 3.00GHz

[15:30:22] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:612]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\ACCOUNT\Desktop\Minecraft\Modding\Alchemy\run\.\crash-reports\crash-2016-02-23_15.30.22-client.txt

AL lib: (EE) alc_cleanup: 1 device not closed

Java HotSpot 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

Posted

Thanks that worked great but now how can i get the quad to always face the player?  I looked at RenderSnowball and found that it uses

GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);

but i dont see a way to use that in a tile entity renderer(the this.rendermanager part).

Posted

Well.  What Type is

renderManager

?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Ok, that's fine.  Sometimes you find that it's an object you already have access to (e.g. if it had been of type WorldRenderer that would have been handy).

 

The point is to see where you can get an instance, as you shouldn't need to create one.  Where does RenderSnowball get its RenderManager from?  Right-click -> References -> Entire Solution

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

i dont know where that is called for RenderSnowball.

 

Cough:

 

Right-click -> References -> Entire Solution

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Thank you i didnt think that it would work on that but I found it.  Its a private variable but you can use Minecraft.getMinecraft.getRenderManager() to get it.  My new problem is that when i cast the tile entity given to me by the method to my tileentity its not the right instance.  I have a list of items stored in it that i can access from onBlockActivated in my block class but the size of it doesnt match the size of the one I get in the TileEntitySpecialRenderer.

Posted

How do you retrieve the TileEntity contents when the block is right-clicked? How do you do the same in the rendering class?

 

If there is any difference, that's the source of your problem. If they are exactly the same, how are you keeping the client (renderer) data synced with the server data? How are you adding items to your TileEntity in the first place? Hopefully only on the server.

 

Show some current code for the above things and it will be easier to help you.

Posted

Well after reading your response it is obvious to me that i dont know what im doing but here is what i have so far:

 

 

 

Block:

package com.drok0920.alchemy.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;

import com.drok0920.alchemy.tileentity.CauldronTileEntity;

public class WoodenCauldronBlock extends Block implements ITileEntityProvider {

public WoodenCauldronBlock(Material materialIn) {
        super(materialIn);
        this.setCreativeTab(CreativeTabs.tabBrewing);

    }

@Override
public boolean isOpaqueCube() {

	return false;
}

@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {

	return new CauldronTileEntity(0);
}

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
	CauldronTileEntity tile = (CauldronTileEntity) world.getTileEntity(pos);
	if (tile != null)
	{
		if(!world.isRemote)
		{
			if(playerIn.getCurrentEquippedItem() != null)
			{
				Item item = playerIn.getCurrentEquippedItem().getItem();

					System.out.println("You are clicking with " + item.getUnlocalizedName());
					tile.addItem(playerIn, item, pos);
			}
			else {
				System.out.println("You are not clicking it with anything");
				tile.clearItems();
			}
		}
	}
	return true;
}
}

 

Tile Entity:

package com.drok0920.alchemy.tileentity;

import java.util.ArrayList;

import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;

import com.drok0920.alchemy.recipe.CauldronRecipe;
import com.drok0920.alchemy.recipe.CauldronRecipeHandler;

public class CauldronTileEntity extends TileEntity {

private int tier;
public ArrayList<Item> items = new ArrayList<Item>();

public CauldronTileEntity(int tier) {
	this.tier = tier;

}

public void addItem(EntityPlayer player, Item item, BlockPos pos) {
	items.add(item);
	player.inventory.consumeInventoryItem(item);
	checkRecipes(player, pos);

}

public ArrayList<Item> getItemArray() {

	return this.items;
}

public int getItemSize() {

	return getItemArray().size();
}

public void checkRecipes(EntityPlayer player, BlockPos pos) {
	for(CauldronRecipe recipe : CauldronRecipeHandler.recipes) {
		if(items.size() == recipe.input.size()) {
			for(int i = 0; i < items.size(); i++) {
				if((Item)items.toArray()[i] == (Item)recipe.input.toArray()[i]) {

				}
				else {
					return;
				}
			}

			for(Item item : recipe.output) {
				Entity entity = new EntityItem(worldObj, pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, new ItemStack(item));
		        worldObj.spawnEntityInWorld(entity);
			}
			items.clear();
		}
	}
}

public void clearItems() {
	for(int o = 0; o < items.size(); o++){
		Item item = (Item)items.toArray()[o];

		Entity entity = new EntityItem(worldObj, pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, new ItemStack(item));
        worldObj.spawnEntityInWorld(entity);
        	
	}
	items.clear();
	return;
}
}

 

Renderer:

package com.drok0920.alchemy.tileentityrenderer;

import net.minecraft.client.*;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.*;
import net.minecraft.client.renderer.tileentity.*;
import net.minecraft.client.renderer.vertex.*;
import net.minecraft.item.Item;
import net.minecraft.tileentity.*;

import org.lwjgl.opengl.GL11;

import com.drok0920.alchemy.tileentity.CauldronTileEntity;

public class CauldronRenderer extends TileEntitySpecialRenderer<CauldronTileEntity> {

@Override
public void renderTileEntityAt(CauldronTileEntity te, double x, double y, double z,
		float partialTicks, int destroyStage) {
    
	CauldronTileEntity tile = (CauldronTileEntity)te;

    this.bindTexture(TextureMap.locationBlocksTexture);
    
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldRenderer = tessellator.getWorldRenderer();
    
    GL11.glPushMatrix();
        GlStateManager.enableRescaleNormal();
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
    
    GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY + 180, 0.0F, 1.0F, 0.0F);
    
    GL11.glTranslated(x, y+1, z);
    
    
    int i = 0;
    worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    //System.out.println(tile.getItemSize());
    tile.clearItems();
    if(tile.getItemSize() != 0) {
	    for(Item item : (Item[])tile.getItemArray().toArray()) {
	    	
		    System.out.println("Adding Item with Index: " + i);
	    	
	    	float itemx = -(tile.items.size() / 2) + i;
	    	float itemy = 0;
	    	
		    worldRenderer.pos(itemx, 2, 0).tex(0, 0).endVertex();
		    worldRenderer.pos(itemx + 1, 2, 0).tex(1, 0).endVertex();
		    worldRenderer.pos(itemx + 1, 3, 0).tex(1, 1).endVertex();
		    worldRenderer.pos(itemx, 3, 0).tex(0, 1).endVertex();
	    	
	    	i++;
	    }
    }
    tessellator.draw();
    
    GL11.glPopMatrix();
}

}

 

 

Posted

Ok so i fixed that issue and i can load the textures of the items being processed but it only uses the texture of the most recently bound texture.  Is there a way to fix this?

 

My current code:

if(tile.getItemSize() != 0) {
	    for(Item item : tile.getItemArray()) {
	    	
		    System.out.println("Adding Item with Index: " + i);
	    	
	    	float itemx = -(tile.items.size() / 2) + i;
	    	float itemy = 0;
	    	
		    this.bindTexture(new ResourceLocation("minecraft", 
		    		"textures/items/" + item.getUnlocalizedName().substring(5) + ".png"));
	    	
		    worldRenderer.pos(itemx, 2, 0).tex(0, 0).endVertex();
		    worldRenderer.pos(itemx + 1, 2, 0).tex(1, 0).endVertex();
		    worldRenderer.pos(itemx + 1, 3, 0).tex(1, 1).endVertex();
		    worldRenderer.pos(itemx, 3, 0).tex(0, 1).endVertex();
	    	
	    	i++;
	    }
    }

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.

×
×
  • Create New...

Important Information

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