Jump to content

[1.12] Crash while trying to render model


WaffleMan0310

Recommended Posts

I am trying to render a model I made, and the game keeps crashing whenever I place the block and then whenever I load up said world from there on out. I have checked the logs and there are no warnings about more than 4 vertices, which is the only thing I've read thus far that can cause this. 

 

Heres is the crash report:

---- Minecraft Crash Report ----
// My bad.

Time: 2/7/18 3:25 PM
Description: Tesselating block model

java.lang.ArrayIndexOutOfBoundsException: 3
	at net.minecraftforge.client.model.pipeline.VertexLighterFlat.processQuad(VertexLighterFlat.java:111)
	at net.minecraftforge.client.model.pipeline.QuadGatheringTransformer.put(QuadGatheringTransformer.java:63)
	at net.minecraftforge.client.model.pipeline.UnpackedBakedQuad.pipe(UnpackedBakedQuad.java:82)
	at net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer.render(ForgeBlockModelRenderer.java:106)
	at net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer.renderModelSmooth(ForgeBlockModelRenderer.java:85)
	at net.minecraft.client.renderer.BlockModelRenderer.renderModel(BlockModelRenderer.java:47)
	at net.minecraft.client.renderer.BlockModelRenderer.renderModel(BlockModelRenderer.java:38)
	at com.waffleman0310.ancientmagicks.client.renderer.tileentity.base.AncientMagicksTESR.renderModel(AncientMagicksTESR.java:51)
	at com.waffleman0310.ancientmagicks.client.renderer.tileentity.TileEntityArcanistSmelteryRender.renderTileEntity(TileEntityArcanistSmelteryRender.java:24)
	at com.waffleman0310.ancientmagicks.client.renderer.tileentity.TileEntityArcanistSmelteryRender.renderTileEntity(TileEntityArcanistSmelteryRender.java:12)
	at com.waffleman0310.ancientmagicks.client.renderer.tileentity.base.AncientMagicksTESR.func_192841_a(AncientMagicksTESR.java:38)
	at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_192854_a(TileEntityRendererDispatcher.java:161)
	at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:133)
	at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:732)
	at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1398)
	at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1312)
	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1115)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1176)
	at net.minecraft.client.Minecraft.run(Minecraft.java:431)
	at net.minecraft.client.main.Main.main(Main.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	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(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	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 --
Thread: Client thread
Stacktrace:
	at net.minecraftforge.client.model.pipeline.VertexLighterFlat.processQuad(VertexLighterFlat.java:111)
	at net.minecraftforge.client.model.pipeline.QuadGatheringTransformer.put(QuadGatheringTransformer.java:63)
	at net.minecraftforge.client.model.pipeline.UnpackedBakedQuad.pipe(UnpackedBakedQuad.java:82)
	at net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer.render(ForgeBlockModelRenderer.java:106)
	at net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer.renderModelSmooth(ForgeBlockModelRenderer.java:85)

-- Block model being tesselated --
Details:
	Block: ancientmagicks:arcanists_smeltery
	Block location: World: (136,4,-713), Chunk: (at 8,0,7 in 8,-45; contains blocks 128,0,-720 to 143,255,-705), Region: (0,-2; contains chunks 0,-64 to 31,-33, blocks 0,0,-1024 to 511,255,-513)
	Using AO: true
Stacktrace:
	at net.minecraft.client.renderer.BlockModelRenderer.renderModel(BlockModelRenderer.java:47)
	at net.minecraft.client.renderer.BlockModelRenderer.renderModel(BlockModelRenderer.java:38)
	at com.waffleman0310.ancientmagicks.client.renderer.tileentity.base.AncientMagicksTESR.renderModel(AncientMagicksTESR.java:51)
	at com.waffleman0310.ancientmagicks.client.renderer.tileentity.TileEntityArcanistSmelteryRender.renderTileEntity(TileEntityArcanistSmelteryRender.java:24)
	at com.waffleman0310.ancientmagicks.client.renderer.tileentity.TileEntityArcanistSmelteryRender.renderTileEntity(TileEntityArcanistSmelteryRender.java:12)
	at com.waffleman0310.ancientmagicks.client.renderer.tileentity.base.AncientMagicksTESR.func_192841_a(AncientMagicksTESR.java:38)

-- Block Entity Details --
Details:
	Name: minecraft:com.waffleman0310.ancientmagicks.common.tileentity.tileentityarcanistsmeltery // com.waffleman0310.ancientmagicks.common.tileentity.TileEntityArcanistSmeltery
	Block type: ID #260 (tile.ancientmagicks:arcanists_smeltery // com.waffleman0310.ancientmagicks.common.blocks.BlockArcanistSmeltery)
	Block data value: 0 / 0x0 / 0b0000
	Block location: World: (136,4,-713), Chunk: (at 8,0,7 in 8,-45; contains blocks 128,0,-720 to 143,255,-705), Region: (0,-2; contains chunks 0,-64 to 31,-33, blocks 0,0,-1024 to 511,255,-513)
	Actual block type: ID #260 (tile.ancientmagicks:arcanists_smeltery // com.waffleman0310.ancientmagicks.common.blocks.BlockArcanistSmeltery)
	Actual block data value: 0 / 0x0 / 0b0000
Stacktrace:
	at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_192854_a(TileEntityRendererDispatcher.java:161)
	at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:133)
	at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:732)
	at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1398)
	at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1312)

-- Affected level --
Details:
	Level name: MpServer
	All players: 1 total; [EntityPlayerSP['Player317'/20, l='MpServer', x=137.33, y=4.00, z=-715.46]]
	Chunk stats: MultiplayerChunkCache: 526, 526
	Level seed: 0
	Level generator: ID 01 - flat, ver 0. Features enabled: false
	Level generator options: 
	Level spawn location: World: (137,4,-716), Chunk: (at 9,0,4 in 8,-45; contains blocks 128,0,-720 to 143,255,-705), Region: (0,-2; contains chunks 0,-64 to 31,-33, blocks 0,0,-1024 to 511,255,-513)
	Level time: 319 game time, 319 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: 4 total; [EntityPlayerSP['Player317'/20, l='MpServer', x=137.33, y=4.00, z=-715.46], EntitySlime['Slime'/11302, l='MpServer', x=204.91, y=4.00, z=-641.21], EntitySlime['Slime'/22118, l='MpServer', x=200.18, y=4.14, z=-650.34], EntitySlime['Slime'/13800, l='MpServer', x=216.95, y=4.33, z=-640.51]]
	Retry entities: 0 total; []
	Server brand: fml,forge
	Server type: Integrated singleplayer server
Stacktrace:
	at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
	at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2862)
	at net.minecraft.client.Minecraft.run(Minecraft.java:452)
	at net.minecraft.client.main.Main.main(Main.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	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(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_131, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 1773013152 bytes (1690 MB) / 2491416576 bytes (2376 MB) up to 15262023680 bytes (14555 MB)
	JVM Flags: 0 total; 
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: MCP 9.42 Powered by Forge 14.23.1.2601 5 mods loaded, 5 mods active
	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

	| State     | ID             | Version      | Source                           | Signature |
	|:--------- |:-------------- |:------------ |:-------------------------------- |:--------- |
	| UCHIJAAAA | minecraft      | 1.12.2       | minecraft.jar                    | None      |
	| UCHIJAAAA | mcp            | 9.42         | minecraft.jar                    | None      |
	| UCHIJAAAA | FML            | 8.0.99.99    | forgeSrc-1.12.2-14.23.1.2601.jar | None      |
	| UCHIJAAAA | forge          | 14.23.1.2601 | forgeSrc-1.12.2-14.23.1.2601.jar | None      |
	| UCHIJAAAA | ancientmagicks | 0.0.1        | AncientMagicks                   | None      |

	Loaded coremods (and transformers): 
	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 388.13' Renderer: 'GeForce GTX 1070/PCIe/SSE2'
	Launched Version: 1.12.2
	LWJGL: 2.9.4
	OpenGL: GeForce GTX 1070/PCIe/SSE2 GL version 4.6.0 NVIDIA 388.13, NVIDIA Corporation
	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: Yes
	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: 8x Intel(R) Core(TM) i7-6820HK CPU @ 2.70GHz

 

I will attach the logs as well.

 

I have looked at exactly where it is happening and its showing: 

float[][] lightmap = quadData[lightmapIndex];

so quadData is smaller than lightmapIndex. I don't really know what would cause that and I don't  know enough about what's going on in this class to go further.

 

Heres the TESR:

Spoiler

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.obj.OBJLoader;

import java.util.HashMap;

public abstract class AncientMagicksTESR <T extends TileEntity> extends TileEntitySpecialRenderer<T>{

	private HashMap<ResourceLocation, IBakedModel> models;

	public AncientMagicksTESR(ResourceLocation... models) {
		this.models = new HashMap<>(models.length);

		for (ResourceLocation model : models) {
			this.models.put(model, null);
		}
	}

	public abstract void renderTileEntity(T te, double x, double y, double z, float partialTicks, int destroyStage, float partial, BufferBuilder buffer);

	@Override
	public void func_192841_a(T te, double x, double y, double z, float partialTicks, int destroyStage, float param) {
		GlStateManager.pushMatrix();
		GlStateManager.translate(x, y, z);

		this.renderTileEntity(te, x, y, z, partialTicks, destroyStage, partialTicks, Tessellator.getInstance().getBuffer());

		GlStateManager.translate(-x, -y, -z);
		GlStateManager.popMatrix();
	}

	public void renderModel(T te, ResourceLocation model, double xOffset, double yOffset, double zOffset, BufferBuilder buffer) {
		if (isModelPresent(model)) {
			GlStateManager.translate(xOffset, yOffset, zOffset);

			World world = te.getWorld();
			BlockPos pos = te.getPos();

			Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel(
					world,
					getModelBaked(model),
					world.getBlockState(pos),
					pos,
					buffer,
					true

			);

			GlStateManager.translate(-xOffset, -yOffset, -zOffset);
		}
	}

	private boolean isModelPresent(ResourceLocation modelLoc) {
		return this.models.containsKey(modelLoc);
	}

	private IBakedModel getModelBaked(ResourceLocation modelLoc) {
		if (isModelPresent(modelLoc)) {
			if (this.models.get(modelLoc) == null) {
				IModel model;
				try {
					model = OBJLoader.INSTANCE.loadModel(modelLoc);
				} catch (Exception e) {
					throw new RuntimeException(e);
				}

				IBakedModel bakedModel = model.bake(
						model.getDefaultState(),
						DefaultVertexFormats.BLOCK,
						(resourceLocation) -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(resourceLocation.toString())
				);

				this.models.put(modelLoc, bakedModel);
			}

			return this.models.get(modelLoc);
		} else {
			return null;
		}
	}
}

 


import com.waffleman0310.ancientmagicks.client.renderer.tileentity.base.AncientMagicksTESR;
import com.waffleman0310.ancientmagicks.common.tileentity.TileEntityArcanistSmeltery;
import com.waffleman0310.ancientmagicks.util.AncientMagicksUtil;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;


@SideOnly(Side.CLIENT)
public class TileEntityArcanistSmelteryRender extends AncientMagicksTESR<TileEntityArcanistSmeltery> {

	public static final ResourceLocation SMELTERY_MODEL = AncientMagicksUtil.getModResource("models/block/multiblock/arcanists_smeltery.obj");
	//public static final ResourceLocation SMELTERY_REAGENT_MODEL = AncientMagicksUtil.getModResource("models/arcanist_smeltery_reagent.obj");

	public TileEntityArcanistSmelteryRender() {
		super(SMELTERY_MODEL);
	}

	@Override
	public void renderTileEntity(TileEntityArcanistSmeltery te, double x, double y, double z, float partialTicks, int destroyStage, float partial, BufferBuilder buffer) {
		renderModel(te, SMELTERY_MODEL, 0, 0, 0, buffer);
		/*
		renderModel(te, SMELTERY_REAGENT_MODEL, 0, 0, 0, buffer);
		renderModel(te, SMELTERY_REAGENT_MODEL, 0, 0, 0, buffer);
		renderModel(te, SMELTERY_REAGENT_MODEL, 0, 0, 0, buffer);
		*/
	}
}

 

 

 

Thanks in advance!

latest.log

Edited by WaffleMan0310
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.