Posted May 11, 20205 yr I'm getting the following error when I go to create a TER: java.lang.IllegalStateException: Not filled all elements of the vertex Here is the stack trace that follows: Spoiler java.lang.IllegalStateException: Not filled all elements of the vertex at net.minecraft.client.renderer.BufferBuilder.endVertex(BufferBuilder.java:225) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at com.novamachina.ens.client.render.SieveRender.render(SieveRender.java:41) ~[main/:?] {re:classloading} at com.novamachina.ens.client.render.SieveRender.render(SieveRender.java:14) ~[main/:?] {re:classloading} at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.render(TileEntityRendererDispatcher.java:100) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.lambda$renderTileEntity$0(TileEntityRendererDispatcher.java:84) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.runCrashReportable(TileEntityRendererDispatcher.java:120) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:83) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.WorldRenderer.updateCameraAndRender(WorldRenderer.java:1002) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:612) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:434) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:961) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:558) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:177) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.0.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.0.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.0.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.0.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.0.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.1.61_mapped_snapshot_20200427-1.15.1-recomp.jar:?] {} I'm following McJty's tutorial (at least pretty closely) and I'm not entirely sure what I'm missing. Here's the TER: Spoiler public class SieveRender extends TileEntityRenderer<SieveTile> { public SieveRender( TileEntityRendererDispatcher rendererDispatcherIn) { super(rendererDispatcherIn); } @Override public void render(SieveTile tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { IVertexBuilder builder = bufferIn.getBuffer(RenderType.getSolid()); matrixStackIn.push(); matrixStackIn.translate(tileEntityIn.getPos().getX(), tileEntityIn.getPos().getY(), tileEntityIn.getPos().getZ()); if(tileEntityIn.getTexture() != null && !tileEntityIn.getBlockStack().isEmpty()) { TextureAtlasSprite icon = tileEntityIn.getTexture(); float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); double height = 1.0f - tileEntityIn.getProgress(); float fillAmount = (float) (0.15625 * height + 0.84375); builder.pos(matrixStackIn.getLast().getMatrix(),0.0625F, fillAmount, 0.0625F).tex(minU, minV).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.0625F, fillAmount, 0.9375F).tex(minU, maxV).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.9375F, fillAmount, 0.9375F).tex(maxU, maxV).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.9375F, fillAmount, 0.0625F).tex(maxU, minV).normal(0, 1, 0).endVertex(); } matrixStackIn.pop(); } public static void register() { ClientRegistry.bindTileEntityRenderer(ModTiles.SIEVE_TILE.get(), SieveRender::new); } } Here is the getTexture on the Tile Entity: Spoiler public TextureAtlasSprite getTexture() { if (!blockStack.isEmpty()) { return Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes() .getTexture(((BlockItem) blockStack.getItem()).getBlock().getDefaultState(), getWorld(), getPos()); } return null; } Any help would be greatly appreciated! (And yes, I am aware that my mod id is too short. I haven't gotten around to changing it yet.)
May 11, 20205 yr Hi A vertex follows a particular format (see DefaultVertexFormats and RenderType) depending on which render buffer you are writing to eg private static final RenderType SOLID = makeType("solid", DefaultVertexFormats.BLOCK, 7, 2097152, true, false, RenderType.State.getBuilder().shadeModel(SHADE_ENABLED).lightmap(LIGHTMAP_ENABLED).texture(BLOCK_SHEET_MIPPED).build(true)); public static final VertexFormat BLOCK = new VertexFormat(ImmutableList.<VertexFormatElement>builder().add(POSITION_3F).add(COLOR_4UB).add(TEX_2F).add(TEX_2SB).add(NORMAL_3B).add(PADDING_1B).build()); versus public static final RenderType.Type LINES = makeType("lines", DefaultVertexFormats.POSITION_COLOR, 1, 256, RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.empty())).layer(PROJECTION_LAYERING).transparency public static final VertexFormat POSITION_COLOR = new VertexFormat(ImmutableList.<VertexFormatElement>builder().add(POSITION_3F).add(COLOR_4UB).build()); When you write a vertex to SOLID, you need to supply position (3 floats), colour (4 bytes), texture (2 floats), light map (2 shorts), normals (3 bytes), plus 1 byte padding. But for LINES you only supply position (3 floats) and colour (4 bytes). So for example- if the code you're using to render to the buffer (during your TER rendering) assumes that the buffer is LINES, but the buffer is actually SOLID, then your code will only write (3 floats + 4 bytes) for each vertex, which is not enough to fill all the elements of the vertex. -TGG
May 11, 20205 yr Author Ok that makes sense. I updated my points to the following: builder.pos(matrixStackIn.getLast().getMatrix(),0.0625F, fillAmount, 0.0625F).color(1.0F, 1.0F, 1.0F, 1.0F).tex(minU, minV).lightmap(0, 240).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.0625F, fillAmount, 0.9375F).color(1.0F, 1.0F, 1.0F, 1.0F).tex(minU, maxV).lightmap(0, 240).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.9375F, fillAmount, 0.9375F).color(1.0F, 1.0F, 1.0F, 1.0F).tex(maxU, maxV).lightmap(0, 240).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.9375F, fillAmount, 0.0625F).color(1.0F, 1.0F, 1.0F, 1.0F).tex(maxU, minV).lightmap(0, 240).normal(0, 1, 0).endVertex(); This stops the crash from happening. However, I'm not getting anything to render still. I've tried reversing the points because I know that planes are one directional and that still didn't get me anything. Also, do I want to use the SOLID RenderType, or should I be using something else? Edited May 11, 20205 yr by Tikaji
May 12, 20205 yr Hi It really depends on what effect you're trying to achieve. If you just want a block shape, consider using BlockBench and exporting as an entity model or block model, and rendering that. Or alternatively, using Blender and exporting as an obj (wavefront model). (Examples in this project if you need them: https://github.com/TheGreyGhost/MinecraftByExample) Adding vertices manually is usually the hard way of doing it. Unless you're aiming for a specific effect (eg like the Beacon) I'd consider using a standard method. -TGG
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.