Jump to content

[1.7.10] Problem rendering model in ISimpleBlockRenderingHandler


Romejanic

Recommended Posts

Hye everyone,

 

I am making a mod which replaces the Tall Grass/Dead Bush/Flower/etc rendering to realistic 3D models. I am using the advanced model loader to lead and render the models, but I cannot do anything in the block renderer other than using the RenderBlocks field or drawing it myself with the GL11.glVertex() functions. The tessellator will says it is already drawing when you call tessellator.startDrawing() (which the OBJ model does), and it says it is not drawing when I call tessellator.draw() to reset it. (I also tried to use the vanilla models by drawing ModelPig, and that didn't work either, same problem)

 

Here's the crash report:

---- Minecraft Crash Report ----
// Hey, that tickles! Hehehe!

Time: 1/8/15 5:53 PM
Description: Unexpected error

java.lang.IllegalStateException: Already tesselating!
at net.minecraft.client.renderer.Tessellator.startDrawing(Tessellator.java:271)
at net.minecraftforge.client.model.obj.WavefrontObject.renderAll(WavefrontObject.java:181)
at assets.foliage.client.render.RealisticBlockRenderer.renderWorldBlock(RealisticBlockRenderer.java:48)
at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:118)
at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:53)
at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:435)
at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207)
at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1647)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1271)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1095)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
at net.minecraft.client.Minecraft.run(Minecraft.java:961)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)


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

-- Head --
Stacktrace:
at net.minecraft.client.renderer.Tessellator.startDrawing(Tessellator.java:271)
at net.minecraftforge.client.model.obj.WavefrontObject.renderAll(WavefrontObject.java:181)
at assets.foliage.client.render.RealisticBlockRenderer.renderWorldBlock(RealisticBlockRenderer.java:48)
at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:118)
at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:53)
at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:435)
at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207)
at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1647)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1271)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player362'/164, l='MpServer', x=-323.33, y=67.62, z=-183.30]]
Chunk stats: MultiplayerChunkCache: 45, 45
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (-317,64,-172), Chunk: (at 3,4,4 in -20,-11; contains blocks -320,0,-176 to -305,255,-161), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Level time: 284638 game time, 1200 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: 64 total; [EntitySquid['Squid'/34, l='MpServer', x=-382.73, y=53.13, z=-217.52], EntitySkeleton['Skeleton'/35, l='MpServer', x=-378.50, y=17.00, z=-195.50], EntitySquid['Squid'/32, l='MpServer', x=-381.22, y=54.34, z=-227.69], EntitySquid['Squid'/33, l='MpServer', x=-376.16, y=56.28, z=-224.31], EntitySquid['Squid'/38, l='MpServer', x=-370.77, y=59.28, z=-205.13], EntityEnderman['Enderman'/39, l='MpServer', x=-379.31, y=20.00, z=-182.22], EntitySkeleton['Skeleton'/36, l='MpServer', x=-378.50, y=17.00, z=-192.50], EntitySkeleton['Skeleton'/37, l='MpServer', x=-378.50, y=17.00, z=-193.50], EntityZombie['Zombie'/42, l='MpServer', x=-381.84, y=13.00, z=-158.50], EntityZombie['Zombie'/43, l='MpServer', x=-375.47, y=16.00, z=-158.97], EntityCreeper['Creeper'/40, l='MpServer', x=-375.50, y=15.00, z=-160.50], EntityZombie['Zombie'/41, l='MpServer', x=-373.39, y=14.00, z=-162.39], EntitySquid['Squid'/46, l='MpServer', x=-367.34, y=56.00, z=-233.81], EntitySkeleton['Skeleton'/47, l='MpServer', x=-366.50, y=13.00, z=-165.50], EntitySkeleton['Skeleton'/44, l='MpServer', x=-369.50, y=15.00, z=-142.50], EntityClientPlayerMP['Player362'/164, l='MpServer', x=-323.33, y=67.62, z=-183.30], EntitySquid['Squid'/51, l='MpServer', x=-361.72, y=45.34, z=-154.47], EntitySquid['Squid'/50, l='MpServer', x=-354.44, y=54.06, z=-167.53], EntitySquid['Squid'/49, l='MpServer', x=-355.50, y=57.19, z=-160.94], EntityBat['Bat'/48, l='MpServer', x=-363.53, y=11.00, z=-170.09], EntityEnderman['Enderman'/55, l='MpServer', x=-353.34, y=17.00, z=-133.34], EntityZombie['Zombie'/54, l='MpServer', x=-362.44, y=18.00, z=-136.50], EntitySkeleton['Skeleton'/53, l='MpServer', x=-365.88, y=17.00, z=-137.50], EntitySkeleton['Skeleton'/52, l='MpServer', x=-361.50, y=18.00, z=-136.50], EntityEnderman['Enderman'/57, l='MpServer', x=-356.50, y=17.00, z=-134.50], EntityEnderman['Enderman'/56, l='MpServer', x=-357.50, y=17.00, z=-130.50], EntitySkeleton['Skeleton'/63, l='MpServer', x=-343.50, y=24.00, z=-192.50], EntitySquid['Squid'/62, l='MpServer', x=-342.03, y=53.38, z=-239.16], EntitySquid['Squid'/68, l='MpServer', x=-340.59, y=47.19, z=-169.19], EntityCreeper['Creeper'/69, l='MpServer', x=-351.50, y=17.00, z=-133.50], EntityCreeper['Creeper'/70, l='MpServer', x=-350.50, y=17.00, z=-132.50], EntityZombie['Zombie'/71, l='MpServer', x=-335.50, y=32.00, z=-201.50], EntitySquid['Squid'/64, l='MpServer', x=-346.75, y=53.19, z=-201.50], EntityBat['Bat'/65, l='MpServer', x=-340.71, y=24.06, z=-186.68], EntityBat['Bat'/66, l='MpServer', x=-339.25, y=23.00, z=-188.06], EntitySquid['Squid'/67, l='MpServer', x=-348.66, y=39.97, z=-191.03], EntitySkeleton['Skeleton'/78, l='MpServer', x=-313.15, y=21.00, z=-214.29], EntityBat['Bat'/79, l='MpServer', x=-317.25, y=44.10, z=-195.25], EntityBat['Bat'/72, l='MpServer', x=-326.13, y=32.00, z=-189.25], EntitySkeleton['Skeleton'/73, l='MpServer', x=-327.47, y=35.00, z=-190.09], EntitySkeleton['Skeleton'/74, l='MpServer', x=-327.00, y=35.00, z=-188.50], EntitySkeleton['Skeleton'/85, l='MpServer', x=-319.13, y=54.00, z=-195.50], EntityCreeper['Creeper'/84, l='MpServer', x=-318.00, y=50.00, z=-196.50], EntitySkeleton['Skeleton'/87, l='MpServer', x=-311.53, y=43.00, z=-188.69], EntitySkeleton['Skeleton'/86, l='MpServer', x=-311.50, y=43.00, z=-186.31], EntityZombie['Zombie'/81, l='MpServer', x=-305.69, y=43.00, z=-199.00], EntityBat['Bat'/80, l='MpServer', x=-316.25, y=42.10, z=-195.25], EntitySkeleton['Skeleton'/83, l='MpServer', x=-305.28, y=43.00, z=-196.00], EntityZombie['Zombie'/82, l='MpServer', x=-305.69, y=43.00, z=-197.00], EntityZombie['Zombie'/89, l='MpServer', x=-312.48, y=43.00, z=-188.70], EntityZombie['Zombie'/88, l='MpServer', x=-314.93, y=43.00, z=-188.70], EntitySkeleton['Skeleton'/102, l='MpServer', x=-295.03, y=14.00, z=-133.56], EntitySkeleton['Skeleton'/103, l='MpServer', x=-291.56, y=17.00, z=-140.06], EntityCreeper['Creeper'/100, l='MpServer', x=-296.63, y=49.00, z=-185.06], EntitySquid['Squid'/101, l='MpServer', x=-294.09, y=45.38, z=-158.94], EntityBat['Bat'/98, l='MpServer', x=-293.31, y=44.10, z=-184.13], EntitySkeleton['Skeleton'/99, l='MpServer', x=-303.50, y=43.00, z=-183.50], EntityZombie['Zombie'/96, l='MpServer', x=-303.50, y=43.00, z=-196.03], EntityBat['Bat'/97, l='MpServer', x=-297.94, y=44.10, z=-184.75], EntityZombie['Zombie'/110, l='MpServer', x=-283.50, y=12.00, z=-139.50], EntityCreeper['Creeper'/108, l='MpServer', x=-278.69, y=11.00, z=-131.56], EntityWitch['Witch'/109, l='MpServer', x=-279.50, y=12.00, z=-137.50], EntitySquid['Squid'/106, l='MpServer', x=-274.53, y=57.97, z=-215.47], EntitySkeleton['Skeleton'/107, l='MpServer', x=-276.34, y=12.00, z=-129.66]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:417)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2568)
at net.minecraft.client.Minecraft.run(Minecraft.java:990)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Mac OS X (x86_64) version 10.10.1
Java Version: 1.6.0_65, Apple Inc.
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Apple Inc.
Memory: 934749536 bytes (891 MB) / 1065025536 bytes (1015 MB) up to 1065025536 bytes (1015 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP v9.05 FML v7.10.18.1180 Minecraft Forge 10.13.0.1180 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.18.1180} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.0.1180} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
foliage{1.0} [Realistic Foliage] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: AMD Radeon HD 6970M OpenGL Engine GL version 2.1 ATI-1.28.29, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because ARB_framebuffer_object is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

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)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)

 

And here's my block renderer:

package assets.foliage.client.render;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.obj.GroupObject;
import net.minecraftforge.client.model.obj.Vertex;
import net.minecraftforge.client.model.obj.WavefrontObject;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;

public class RealisticBlockRenderer implements ISimpleBlockRenderingHandler {

private WavefrontObject tallGrass;

public RealisticBlockRenderer() {

	tallGrass = (WavefrontObject)AdvancedModelLoader.loadModel(new ResourceLocation("foliage:models/Bush1.obj"));

}

@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {



}

@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {

	Tessellator tessellator = Tessellator.instance;

	if(block == Blocks.tallgrass) {

		GL11.glPushMatrix();
		GL11.glTranslatef(x, y, z);

		float scale = 0.5f;
		GL11.glScalef(scale, scale, scale);

		tallGrass.renderAll();

		GL11.glPopMatrix();


		return true;

	}

	return false;

}

@Override
public boolean shouldRender3DInInventory(int modelId) {

	return false;

}

@Override
public int getRenderId() {

	return Foliage.proxy.renderHandler;

}

}

 

Thanks for your help, it is greatly appreciated!

- Romejanic

Romejanic

 

Creator of Witch Hats, Explosive Chickens and Battlefield!

Link to comment
Share on other sites

If you call draw() to reset, you need to end your function by calling startDrawing, or the next thing Minecraft tries to draw won't have an active tessellator (it gave you one and you ended it without starting a new one).

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.

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.



×
×
  • Create New...

Important Information

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