Jump to content

Recommended Posts

Posted

I am trying to add a custom model to my block, but it crashes when placed in the world.

 

BlockEggStand:

 

 

public class BlockEggStand extends Block{
public BlockEggStand() {
	super(Material.iron);
	this.setCreativeTab(StrongholdCraft.tabStrongholdCraft);

}

public int getRenderType()
{
	return BlockEggStandRenderer.myRenderID;
}
}

 

 

 

ClientProxy:

 

 

public class ClientProxy extends CommonProxy {

public void registerRenderers(){
	RenderingRegistry.registerBlockHandler(new BlockEggStandRenderer());
}
@Override
public int addArmor(String armor)
{
	return RenderingRegistry.addNewArmourRendererPrefix(armor);
}
}

 

 

 

BlockEggStandRenderer:

 

 

public class BlockEggStandRenderer implements ISimpleBlockRenderingHandler {

IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("strongholdcraft:models/eggStand.obj"));

public static int myRenderID;

public BlockEggStandRenderer() {
	BlockEggStandRenderer.myRenderID = RenderingRegistry.getNextAvailableRenderId();
}

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
	GL11.glTranslatef(-0.5F, -0.5F, 0.5F);
	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("textures/blocks/iron_block.png"));
	model.renderAll();
	GL11.glTranslatef(0.5F, 0.5F, -0.5F);

}

@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	GL11.glTranslatef(-0.5F, -0.5F, 0.5F);
	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("textures/blocks/iron_block.png"));
model.renderAll();
	GL11.glTranslatef(0.5F, 0.5F, -0.5F);
	return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
	return true;
}
@Override
public int getRenderId() {
	return BlockEggStandRenderer.myRenderID;
}

}

 

 

 

crash report:

 

 

[21:21:45] [Client thread/FATAL]: Unreported exception thrown!
java.lang.IllegalStateException: Already tesselating!
at net.minecraft.client.renderer.Tessellator.startDrawing(Tessellator.java:301) ~[Tessellator.class:?]
at net.minecraftforge.client.model.obj.WavefrontObject.renderAll(WavefrontObject.java:182) ~[WavefrontObject.class:?]
at strongholdCraft.common.render.BlockEggStandRenderer.renderWorldBlock(BlockEggStandRenderer.java:41) ~[blockEggStandRenderer.class:?]
at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:118) ~[RenderingRegistry.class:?]
at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:53) ~[FMLRenderAccessLibrary.class:?]
at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:522) ~[RenderBlocks.class:?]
at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:246) ~[WorldRenderer.class:?]
at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1672) ~[RenderGlobal.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1325) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1160) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1064) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_40]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_40]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_40]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_40]
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:?]
---- Minecraft Crash Report ----
// Oops.

Time: 2/11/14 9:21 PM
Description: Unexpected error

java.lang.IllegalStateException: Already tesselating!
at net.minecraft.client.renderer.Tessellator.startDrawing(Tessellator.java:301)
at net.minecraftforge.client.model.obj.WavefrontObject.renderAll(WavefrontObject.java:182)
at strongholdCraft.common.render.BlockEggStandRenderer.renderWorldBlock(BlockEggStandRenderer.java:41)
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:522)
at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:246)
at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1672)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1325)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1160)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1064)
at net.minecraft.client.Minecraft.run(Minecraft.java:951)
at net.minecraft.client.main.Main.main(Main.java:112)
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:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


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:301)
at net.minecraftforge.client.model.obj.WavefrontObject.renderAll(WavefrontObject.java:182)
at strongholdCraft.common.render.BlockEggStandRenderer.renderWorldBlock(BlockEggStandRenderer.java:41)
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:522)
at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:246)
at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1672)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1325)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player541'/206, l='MpServer', x=129.82, y=65.13, z=318.79]]
Chunk stats: MultiplayerChunkCache: 256, 256
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (132,64,295), Chunk: (at 4,4,7 in 8,18; contains blocks 128,0,288 to 143,255,303), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 32478 game time, 4313 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: 113 total; [EntitySkeleton['Skeleton'/4135, l='MpServer', x=160.13, y=27.00, z=312.63], EntityBat['Bat'/4611, l='MpServer', x=73.44, y=17.54, z=384.75], EntityZombie['Zombie'/4139, l='MpServer', x=158.44, y=26.00, z=311.50], EntitySkeleton['Skeleton'/4141, l='MpServer', x=157.44, y=26.00, z=312.09], EntityCreeper['Creeper'/4151, l='MpServer', x=170.50, y=31.00, z=287.03], EntityCreeper['Creeper'/3002, l='MpServer', x=139.50, y=54.00, z=272.50], EntityItem['item.tile.eggStand'/1651, l='MpServer', x=129.09, y=61.13, z=314.38], EntityCreeper['Creeper'/5714, l='MpServer', x=81.50, y=21.00, z=384.50], EntityCreeper['Creeper'/5715, l='MpServer', x=84.50, y=21.00, z=384.50], EntityZombie['Zombie'/5716, l='MpServer', x=76.75, y=23.00, z=388.16], EntityBat['Bat'/5197, l='MpServer', x=62.34, y=36.00, z=386.72], EntitySpider['Spider'/6000, l='MpServer', x=165.50, y=26.00, z=377.50], EntityZombie['Zombie'/6001, l='MpServer', x=183.34, y=31.00, z=386.91], EntityCreeper['Creeper'/6002, l='MpServer', x=179.50, y=31.00, z=384.50], EntityZombie['Zombie'/6003, l='MpServer', x=190.50, y=25.00, z=316.50], EntityCow['Cow'/55, l='MpServer', x=63.16, y=71.00, z=312.19], EntitySkeleton['Skeleton'/2493, l='MpServer', x=58.50, y=61.00, z=338.50], EntityCow['Cow'/57, l='MpServer', x=59.41, y=74.00, z=322.63], EntityCow['Cow'/56, l='MpServer', x=50.22, y=75.00, z=314.81], EntityBat['Bat'/3788, l='MpServer', x=96.43, y=24.07, z=373.27], EntityBat['Bat'/1848, l='MpServer', x=173.25, y=23.10, z=285.25], EntityEnderman['Enderman'/6393, l='MpServer', x=81.50, y=40.00, z=285.50], EntityCreeper['Creeper'/6391, l='MpServer', x=97.50, y=42.00, z=377.50], EntityCow['Cow'/76, l='MpServer', x=71.28, y=68.00, z=303.75], EntitySquid['Squid'/3465, l='MpServer', x=175.41, y=57.66, z=370.44], EntityPig['Pig'/78, l='MpServer', x=76.19, y=71.00, z=379.91], EntityPig['Pig'/79, l='MpServer', x=78.50, y=78.00, z=376.50], EntitySquid['Squid'/3471, l='MpServer', x=169.28, y=57.88, z=362.50], EntitySquid['Squid'/3470, l='MpServer', x=171.25, y=59.19, z=365.13], EntityCreeper['Creeper'/3229, l='MpServer', x=87.50, y=36.00, z=376.50], EntitySquid['Squid'/3468, l='MpServer', x=169.50, y=56.00, z=366.19], EntityCreeper['Creeper'/3231, l='MpServer', x=83.50, y=36.00, z=380.50], EntitySquid['Squid'/3475, l='MpServer', x=185.88, y=55.22, z=373.84], EntityCreeper['Creeper'/3749, l='MpServer', x=90.50, y=25.00, z=283.50], EntityZombie['Zombie'/81, l='MpServer', x=65.50, y=30.00, z=387.50], EntityPig['Pig'/80, l='MpServer', x=78.47, y=72.00, z=377.53], EntityCow['Cow'/95, l='MpServer', x=91.31, y=63.00, z=303.47], EntityCow['Cow'/94, l='MpServer', x=80.50, y=72.00, z=293.38], EntityCow['Cow'/102, l='MpServer', x=81.38, y=64.00, z=331.34], EntityCow['Cow'/103, l='MpServer', x=87.06, y=64.00, z=322.03], EntityZombie['Zombie'/7146, l='MpServer', x=169.06, y=25.00, z=259.50], EntityCow['Cow'/100, l='MpServer', x=81.31, y=67.00, z=327.47], EntityCow['Cow'/101, l='MpServer', x=87.47, y=68.00, z=324.31], EntityCreeper['Creeper'/6602, l='MpServer', x=63.50, y=36.00, z=390.50], EntityCow['Cow'/98, l='MpServer', x=87.28, y=70.00, z=305.47], EntityZombie['Zombie'/4981, l='MpServer', x=199.50, y=37.00, z=325.50], EntityCow['Cow'/99, l='MpServer', x=88.59, y=63.00, z=317.31], EntityZombie['Zombie'/6600, l='MpServer', x=64.50, y=36.00, z=389.50], EntityCow['Cow'/96, l='MpServer', x=91.81, y=62.06, z=309.09], EntityCreeper['Creeper'/6601, l='MpServer', x=61.50, y=36.00, z=393.50], EntityCow['Cow'/97, l='MpServer', x=82.44, y=65.00, z=304.47], EntitySkeleton['Skeleton'/6598, l='MpServer', x=63.50, y=36.00, z=389.50], EntityZombie['Zombie'/6599, l='MpServer', x=60.50, y=36.00, z=388.50], EntitySkeleton['Skeleton'/6596, l='MpServer', x=62.50, y=36.00, z=393.50], EntitySkeleton['Skeleton'/6597, l='MpServer', x=62.50, y=36.00, z=389.50], EntityZombie['Zombie'/6594, l='MpServer', x=183.50, y=58.00, z=241.50], EntityBat['Bat'/6353, l='MpServer', x=192.97, y=20.33, z=275.82], EntityPig['Pig'/106, l='MpServer', x=82.50, y=76.00, z=377.50], EntityBat['Bat'/6352, l='MpServer', x=186.75, y=19.36, z=266.42], EntityZombie['Zombie'/6592, l='MpServer', x=175.88, y=55.00, z=243.47], EntityCow['Cow'/104, l='MpServer', x=94.88, y=69.00, z=340.03], EntityCow['Cow'/119, l='MpServer', x=106.97, y=64.00, z=259.03], EntityCow['Cow'/118, l='MpServer', x=111.69, y=63.00, z=267.50], EntityCow['Cow'/117, l='MpServer', x=110.31, y=60.00, z=272.47], EntitySkeleton['Skeleton'/7162, l='MpServer', x=55.40, y=61.00, z=365.61], EntityZombie['Zombie'/7165, l='MpServer', x=91.50, y=41.00, z=247.50], EntitySkeleton['Skeleton'/7152, l='MpServer', x=167.50, y=56.00, z=272.50], EntityBat['Bat'/125, l='MpServer', x=92.52, y=42.57, z=373.59], EntitySquid['Squid'/123, l='MpServer', x=109.50, y=57.00, z=321.51], EntitySquid['Squid'/122, l='MpServer', x=108.47, y=57.20, z=320.42], EntityCreeper['Creeper'/121, l='MpServer', x=96.50, y=21.00, z=296.50], EntityZombie['Zombie'/6608, l='MpServer', x=142.50, y=11.00, z=307.50], EntityCow['Cow'/120, l='MpServer', x=100.53, y=64.00, z=274.69], EntityCreeper['Creeper'/136, l='MpServer', x=138.47, y=42.00, z=309.97], EntityCreeper['Creeper'/135, l='MpServer', x=141.00, y=42.00, z=315.56], EntityCreeper['Creeper'/3943, l='MpServer', x=146.50, y=34.00, z=288.50], EntityBat['Bat'/5364, l='MpServer', x=168.08, y=37.49, z=277.80], EntitySkeleton['Skeleton'/158, l='MpServer', x=167.50, y=14.00, z=270.50], EntitySquid['Squid'/3416, l='MpServer', x=188.72, y=53.19, z=315.66], EntitySquid['Squid'/3415, l='MpServer', x=191.03, y=54.28, z=314.38], EntityCreeper['Creeper'/7260, l='MpServer', x=114.50, y=15.00, z=315.50], EntityClientPlayerMP['Player541'/206, l='MpServer', x=129.82, y=65.13, z=318.79], EntityBat['Bat'/6739, l='MpServer', x=149.00, y=14.89, z=252.25], EntityBat['Bat'/4606, l='MpServer', x=111.25, y=26.10, z=301.09], EntitySquid['Squid'/3343, l='MpServer', x=167.72, y=54.19, z=343.28], EntityBat['Bat'/4603, l='MpServer', x=117.63, y=25.10, z=301.25], EntityBat['Bat'/4602, l='MpServer', x=110.33, y=23.41, z=306.48], EntitySquid['Squid'/3355, l='MpServer', x=154.58, y=50.05, z=304.50], EntitySquid['Squid'/3354, l='MpServer', x=162.50, y=50.00, z=305.50], EntitySquid['Squid'/3353, l='MpServer', x=185.16, y=52.69, z=352.81], EntitySquid['Squid'/3358, l='MpServer', x=160.16, y=49.00, z=305.44], EntitySquid['Squid'/3357, l='MpServer', x=161.47, y=51.00, z=301.50], EntitySquid['Squid'/3356, l='MpServer', x=157.38, y=49.00, z=303.50], EntitySquid['Squid'/3346, l='MpServer', x=170.66, y=51.81, z=342.28], EntityBat['Bat'/5304, l='MpServer', x=150.46, y=24.18, z=319.85], EntitySquid['Squid'/3344, l='MpServer', x=161.06, y=54.13, z=335.31], EntitySpider['Spider'/5062, l='MpServer', x=164.03, y=53.00, z=261.34], EntitySquid['Squid'/3350, l='MpServer', x=172.66, y=54.34, z=345.75], EntitySpider['Spider'/2123, l='MpServer', x=68.06, y=34.00, z=380.75], EntitySquid['Squid'/3348, l='MpServer', x=177.06, y=54.34, z=346.50], EntityCreeper['Creeper'/5251, l='MpServer', x=166.13, y=15.00, z=280.78], EntitySquid['Squid'/3371, l='MpServer', x=151.81, y=48.00, z=343.38], EntityCreeper['Creeper'/5252, l='MpServer', x=163.50, y=20.00, z=292.50], EntityCreeper['Creeper'/5253, l='MpServer', x=160.94, y=20.00, z=291.38], EntitySquid['Squid'/3374, l='MpServer', x=143.09, y=49.34, z=349.72], EntitySquid['Squid'/3375, l='MpServer', x=144.51, y=47.45, z=336.06], EntityCreeper['Creeper'/7017, l='MpServer', x=102.50, y=45.00, z=276.50], EntitySkeleton['Skeleton'/7018, l='MpServer', x=100.50, y=45.00, z=274.50], EntityZombie['Zombie'/7025, l='MpServer', x=117.50, y=21.00, z=262.50], EntitySquid['Squid'/3377, l='MpServer', x=136.75, y=50.31, z=353.81], EntitySquid['Squid'/3379, l='MpServer', x=152.31, y=48.88, z=347.34], EntitySquid['Squid'/3378, l='MpServer', x=144.91, y=50.34, z=351.28], EntityItem['item.tile.eggStand'/1690, l='MpServer', x=128.25, y=62.13, z=315.16]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:418)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2557)
at net.minecraft.client.Minecraft.run(Minecraft.java:980)
at net.minecraft.client.main.Main.main(Main.java:112)
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:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_40, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 785425712 bytes (749 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 1834 (102704 bytes; 0 MB) allocated, 1800 (100800 bytes; 0 MB) used
IntCache: cache: 1, tcache: 1, allocated: 12, tallocated: 94
FML: MCP v9.01-pre FML v7.2.116.1024 Minecraft Forge 10.12.0.1024 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.116.1024} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.0.1024} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
strongholdcraft{0.0.1} [strongholdCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: AMD Radeon HD 6800 Series GL version 4.2.12002 Compatibility Profile Context 9.12.0.0, ATI Technologies Inc.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: ~~ERROR~~ NullPointerException: null
Profiler Position: N/A (disabled)
Vec3 Pool Size: 2863 (160328 bytes; 0 MB) allocated, 2250 (126000 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
#@!@# Game crashed! Crash report saved to: #@!@# E:\Minecraft Modding\StrongholdCraft\StrongholdCraft 1.7\.\crash-reports\crash-2014-02-11_21.21.45-client.txt
[21:21:45] [server thread/INFO]: Stopping server
[21:21:45] [Client Shutdown Thread/INFO]: Stopping server
[21:21:45] [server thread/INFO]: Saving players
[21:21:45] [Client Shutdown Thread/INFO]: Saving players
[21:21:45] [server thread/INFO]: Saving worlds
[21:21:45] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
AL lib: (EE) alc_cleanup: 1 device not closed

 

 

 

 

 

 

Posted

update for lastest forge

 

I updated to latest forge, updated obfuscations, and the crash is still happening.

I updated the code in the post and the crash report is also updated.

Posted

i know can be a bit crazy but can you put a model = AdvancedModelLoader.loadModel(new ResourceLocation("strongholdcraft:models/eggStand.obj"));

on the 1st line of renderWorldBlock

?

Same crash happens

  • 3 weeks later...
Posted

Before ISimpleBlockRenderingHandler is called the tessellator is started, the model render commands attempt to start the tessellator.

This causes the crash.

 

By adding a tile entity to your block you can use TileEntitySpecialRenderer to solve the problem.

 

Or since your renderer is simple you can stop the tessellator before your code, and start it again after your code.

 

Tessellator.instance.draw();
GL11.glPushMatrix()
<your render code>
GL11.glPopMatrix()
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); // This is required or the textures will be messed up.
Tessellator.instance.startDrawingQuads();

 

This has drawbacks, GL11.glRotatef and GL11.glScalef do not work as expected, both of move the model instead.

 

There might be a better way to render models without tile entities but this is the only one I know of.

 

Bantasaurusrex is correct GL11.glPushMatrix() and GL11.glPopMatrix() are required, otherwise any models drawn after yours messes up.

Posted

Minecraft uses a special class to render, the Tessellator. When the tessellator is used, it has to be started with tessellator.startDrawing(drawmode), where the drawmode is a specific way of drawing specified in OpenGL. When you send a coodinate (a vertex) to the tessellator, it is pushed into an array. This array will continue expanding until you do tessellator.draw(). At that point, the array of vertices is sent to your graphics processor so that it may render it. If tessellator.startDrawing(drawmode) is called while it is already collecting vertices, the "Already tessellating" exception is thrown.

 

You get this problem because Forge's .obj renderer is designed to send its own vertices then draw them instantly. Therefore, it's calling tessellator.startDrawing(drawmode) and tessellator.draw() by itself, which must not be done during the block rendering phase. If you somehow were able to stop the model renderer from calling the suspected methods, there is still a potential problem. Blocks are rendered with the GL_QUADS drawmode, which means a square face will be drawn for every 4 vertices you send in. The model may not be rendered with this drawmode, which would completely mess up the rendering. The model renderer could even have several calls to both startDrawing and draw.

 

Encasing your model.renderAll with Tessellator.instance.draw() above and Tessellator.instance.startDrawingQuads() below in BlockEggStandRenderer.renderWorldBlock is not a viable solution. Because of technical reasons, this can mess up the rendering of the blocks surrounding this one.

 

It's fine to render your .obj model in renderInventoryBlock, but you need another solution for renderWorldBlock. You could try to render your block programmatically instead of using a model, or alternatively give the block a tile entity. Tile entity blocks can be rendered independently from other blocks, and their rendering does not suffer from the limitations of standard block rendering. Either solution should be covered by tutorials.

Posted

I use the implementation that @Glenn advises against, but have not noticed rendering errors. There may be something else at work there.

 

It should be noted that the frivolous use of tile entities is discouraged, so I would try to make it work by instructing the Tessellator instance to "draw" and "startDrawingQuads" at the beginning and end of your method respectively. After doing this, most rendering errors can be dealt with on a case by case basis. Having said that, rendering your block programmatically would be better, like Glenn Suggested, if inconvenient to your artistry.

 

Technical Reason [tek-ni-kuhl ree-zuh n] (noun): You probably can't be bothered. (Shame on you) :P

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hi, i'm really having problems trying to set the texture to my custom item. I thought i'm doing everything correctly, but all i see is the missing texture block for my item. I am trying this for over a week now and getting really frustrated. The only time i could make the texture work, was when i used an older Forge version (52.0.1) for Minecraft (1.21.4). Was there a fundamental change for textures and models somewhere between versions that i'm missing? I started with Forge 54.1.0 and had this problem, so in my frustration i tried many things: Upgrading to Forge 54.1.1, created multiple new projects, workspaces, redownloaded everything and setting things up multiple times, as it was suggested in an older thread. Therea are no errors in the console logs, but maybe i'm blind, so i pasted the console logs to pastebin anyway: https://pastebin.com/zAM8RiUN The only time i see an error is when i change the models JSON file to an incorrect JSON which makes sense and that suggests to me it is actually reading the JSON file.   I set the github repository to public, i would be so thankful if anyone could take a look and tell me what i did wrong: https://github.com/xLorkin/teleport_pug_forge   As a note: i'm pretty new to modding, this is my first mod ever. But i'm used to programming. I had some up and downs, but through reading the documentation, using google and experimenting, i could solve all other problems. I only started modding for Minecraft because my son is such a big fan and wanted this mod.
    • Please read the FAQ (link in orange bar at top of page), and post logs as described there.
    • Hello fellow Minecrafters! I recently returned to Minecraft and realized I needed a wiki that displays basic information easily and had great user navigation. That’s why I decided to build: MinecraftSearch — a site by a Minecraft fan, for Minecraft fans. Key Features So Far Straight-to-the-Point Info: No extra fluff; just the essentials on items, mobs, recipes, loot and more. Clean & Intuitive Layout: Easy navigation so you spend less time scrolling and more time playing. Optimized Search: Search for anything—items, mobs, blocks—and get results instantly. What I’m Thinking of Adding More data/information: Catch chances for fishing rod, traveling villager trades, biomes info and a lot more. The website is still under development and need a lot more data added. Community Contributions: Potential for user-uploaded tips for items/mobs/blocks in the future. Feature Requests Welcome: Your ideas could shape how the wiki evolves! You can see my roadmap at the About page https://minecraftsearch.com/about I’d love for you to check out MinecraftSearch and see if it helps you find the info you need faster. Feedback is crucial—I want to develop this further based on what the community needs most, so please let me know what you think. Thanks, and happy crafting!
    • Instructions on how to install newer Java can be found in the FAQ
    • That's just plain wrong... newer versions are much better optimised and start a lot faster than 1.8.9, both Forge and Minecraft itself. Comparing Fabric 1.21 with Forge 1.8 is like comparing apples and oranges... one's brand new and the other's over a decade old.
  • Topics

×
×
  • Create New...

Important Information

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