Botania Unofficial

Botania Unofficial

794k Downloads

Putting ENOUGH lightning particle generators in an area will overflow the buffer

yrsegal opened this issue ยท 9 comments

commented
[22:20:50] [Client thread/ERROR]: Exception caught during firing event net.minecraftforge.client.event.RenderWorldLastEvent@3a8daf92:
java.nio.BufferOverflowException
    at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:331) ~[?:1.8.0_66]
    at net.minecraft.client.renderer.VertexBuffer.growBuffer(VertexBuffer.java:61) ~[VertexBuffer.class:?]
    at net.minecraft.client.renderer.VertexBuffer.endVertex(VertexBuffer.java:440) ~[VertexBuffer.class:?]
    at vazkii.botania.client.core.handler.LightningHandler.renderBolt(LightningHandler.java:147) ~[LightningHandler.class:?]
    at vazkii.botania.client.core.handler.LightningHandler.onRenderWorldLast(LightningHandler.java:87) ~[LightningHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_106_LightningHandler_onRenderWorldLast_RenderWorldLastEvent.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:49) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?]
    at net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(ForgeHooksClient.java:144) [ForgeHooksClient.class:?]
    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1449) [EntityRenderer.class:?]
    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1283) [EntityRenderer.class:?]
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1092) [EntityRenderer.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1140) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:404) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
    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_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:26) [start/:?]
[22:20:50] [Client thread/ERROR]: Index: 4 Listeners:
[22:20:50] [Client thread/ERROR]: 0: NORMAL
[22:20:50] [Client thread/ERROR]: 1: ASM: vazkii.botania.common.item.ItemCraftingHalo@714a1a49 onRenderWorldLast(Lnet/minecraftforge/client/event/RenderWorldLastEvent;)V
[22:20:50] [Client thread/ERROR]: 2: ASM: shadowfox.botanicaladdons.common.items.travel.bauble.ItemToolbelt$Companion$EventHandler@6c00d532 onRenderWorldLast(Lnet/minecraftforge/client/event/RenderWorldLastEvent;)V
[22:20:50] [Client thread/ERROR]: 3: ASM: shadowfox.botanicaladdons.common.block.base.BlockModLeaves$Companion@6aa4c5c9 onRenderWorldLast(Lnet/minecraftforge/client/event/RenderWorldLastEvent;)V
[22:20:50] [Client thread/ERROR]: 4: ASM: vazkii.botania.client.core.handler.LightningHandler@11ebd65a onRenderWorldLast(Lnet/minecraftforge/client/event/RenderWorldLastEvent;)V
[22:20:50] [Client thread/ERROR]: 5: ASM: vazkii.botania.client.core.handler.BoundTileRenderer@49e84057 onWorldRenderLast(Lnet/minecraftforge/client/event/RenderWorldLastEvent;)V
[22:20:50] [Client thread/ERROR]: 6: ASM: vazkii.botania.client.core.handler.SubTileRadiusRenderHandler@478663f onWorldRenderLast(Lnet/minecraftforge/client/event/RenderWorldLastEvent;)V
[22:20:50] [Client thread/ERROR]: 7: ASM: vazkii.botania.client.core.handler.MultiblockRenderHandler@61a93de8 onWorldRenderLast(Lnet/minecraftforge/client/event/RenderWorldLastEvent;)V
[22:20:50] [Client thread/ERROR]: 8: ASM: vazkii.botania.client.render.world.SkyblockRenderEvents@42050876 onRender(Lnet/minecraftforge/client/event/RenderWorldLastEvent;)V
[22:20:51] [Client thread/FATAL]: Unreported exception thrown!
java.nio.BufferOverflowException
    at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:331) ~[?:1.8.0_66]
    at net.minecraft.client.renderer.VertexBuffer.growBuffer(VertexBuffer.java:61) ~[VertexBuffer.class:?]
    at net.minecraft.client.renderer.VertexBuffer.endVertex(VertexBuffer.java:440) ~[VertexBuffer.class:?]
    at vazkii.botania.client.core.handler.LightningHandler.renderBolt(LightningHandler.java:147) ~[LightningHandler.class:?]
    at vazkii.botania.client.core.handler.LightningHandler.onRenderWorldLast(LightningHandler.java:87) ~[LightningHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_106_LightningHandler_onRenderWorldLast_RenderWorldLastEvent.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:49) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:?]
    at net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(ForgeHooksClient.java:144) ~[ForgeHooksClient.class:?]
    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1449) ~[EntityRenderer.class:?]
    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1283) ~[EntityRenderer.class:?]
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1092) ~[EntityRenderer.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1140) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:404) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
    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_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:26) [start/:?]
[22:20:51] [Client thread/INFO]: [net.minecraft.init.Bootstrap:printToSYSOUT:646]: ---- Minecraft Crash Report ----
// Why did you do that?

Time: 6/13/16 10:20 PM
Description: Unexpected error

java.nio.BufferOverflowException
    at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:331)
    at net.minecraft.client.renderer.VertexBuffer.growBuffer(VertexBuffer.java:61)
    at net.minecraft.client.renderer.VertexBuffer.endVertex(VertexBuffer.java:440)
    at vazkii.botania.client.core.handler.LightningHandler.renderBolt(LightningHandler.java:147)
    at vazkii.botania.client.core.handler.LightningHandler.onRenderWorldLast(LightningHandler.java:87)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_106_LightningHandler_onRenderWorldLast_RenderWorldLastEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:49)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    at net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(ForgeHooksClient.java:144)
    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1449)
    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1283)
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1092)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1140)
    at net.minecraft.client.Minecraft.run(Minecraft.java:404)
    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:497)
    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:497)
    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 java.nio.DirectByteBuffer.put(DirectByteBuffer.java:331)
    at net.minecraft.client.renderer.VertexBuffer.growBuffer(VertexBuffer.java:61)
    at net.minecraft.client.renderer.VertexBuffer.endVertex(VertexBuffer.java:440)
    at vazkii.botania.client.core.handler.LightningHandler.renderBolt(LightningHandler.java:147)
    at vazkii.botania.client.core.handler.LightningHandler.onRenderWorldLast(LightningHandler.java:87)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_106_LightningHandler_onRenderWorldLast_RenderWorldLastEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:49)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    at net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(ForgeHooksClient.java:144)
    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1449)
    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1283)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['yrsegal'/35, l='MpServer', x=-151.20, y=64.00, z=359.08]]
    Chunk stats: MultiplayerChunkCache: 1089, 1089
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: World: (-147,64,359), Chunk: (at 13,4,7 in -10,22; contains blocks -160,0,352 to -145,255,367), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
    Level time: 1343809 game time, 6000 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: survival (ID 0). Hardcore: false. Cheats: false
    Forced entities: 11 total; [EntityPlayerSP['yrsegal'/35, l='MpServer', x=-151.20, y=64.00, z=359.08], EntityHorse['Skeleton Horse'/1, l='MpServer', x=-222.99, y=66.00, z=358.14], EntityCorporeaSpark['Corporea Spark'/3, l='MpServer', x=-180.50, y=65.50, z=396.50], EntityCorporeaSpark['Corporea Spark'/4, l='MpServer', x=-180.50, y=65.50, z=394.50], EntityCorporeaSpark['Corporea Spark'/5, l='MpServer', x=-180.50, y=68.50, z=392.50], EntityItemFrame['entity.ItemFrame.name'/6, l='MpServer', x=-179.97, y=67.50, z=392.50], EntityItemFrame['entity.ItemFrame.name'/7, l='MpServer', x=-179.97, y=64.50, z=392.50], EntityItemFrame['entity.ItemFrame.name'/8, l='MpServer', x=-179.97, y=64.50, z=393.50], EntityItem['item.item.dice'/9, l='MpServer', x=-163.40, y=64.00, z=379.53], EntityItemFrame['entity.ItemFrame.name'/10, l='MpServer', x=-154.03, y=65.50, z=383.50], EntityItemFrame['entity.ItemFrame.name'/11, l='MpServer', x=-153.50, y=65.50, z=382.97]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:448)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2770)
    at net.minecraft.client.Minecraft.run(Minecraft.java:433)
    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:497)
    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:497)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
    Minecraft Version: 1.9.4
    Operating System: Mac OS X (x86_64) version 10.10.5
    Java Version: 1.8.0_66, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 1433622976 bytes (1367 MB) / 2074083328 bytes (1978 MB) up to 3817865216 bytes (3641 MB)
    JVM Flags: 0 total; 
    IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
    FML: MCP 9.28 Powered by Forge 12.17.0.1960 7 mods loaded, 7 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.9.4-12.17.0.1960-PROJECT(NaturalPledge).jar) 
    UCHIJAAAA   Forge{12.17.0.1960} [Minecraft Forge] (forgeSrc-1.9.4-12.17.0.1960-PROJECT(NaturalPledge).jar) 
    UCHIJAAAA   Baubles{1.2.1.0} [Baubles] (Baubles-1.9.4-1.2.1.0.jar) 
    UCHIJAAAA   Botania{r1.8-307} [Botania] (Botania-unofficial.r1.8-307.jar) 
    UCHIJAAAA   botanicaladdons{GRADLE:VERSION.GRADLE:BUILD} [Natural Pledge] (NaturalPledge) 
    UCHIJAAAA   JEI{3.4.0.202} [Just Enough Items] (jei_1.9.4-3.4.0.202.jar) 
    Loaded coremods (and transformers): 
    Launched Version: 1.9.4
    LWJGL: 2.9.2
    OpenGL: Intel Iris Pro OpenGL Engine GL version 2.1 INTEL-10.6.33, Intel Inc.
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because ARB_framebuffer_object 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: net.minecraft.client.Minecraft$15@37a05a2e
[22:20:51] [Client thread/INFO]: [net.minecraft.init.Bootstrap:printToSYSOUT:646]: #@!@# Game crashed! Crash report saved to: #@!@# /Users/wire/GitHub/NaturalPledge/run/./crash-reports/crash-2016-06-13_22.20.51-client.txt
[22:20:51] [Client Shutdown Thread/INFO]: Stopping server

There should probably be a check to prevent the lightning handler from overflowing the vertex buffer, since this is something the average player can do with a few stacks of resource.

commented

how many did you try? 0.o lol

commented

uh... 46 ones which fired two bolts at once

commented

this is what I get for stresstesting a feature

commented

#blamechickenbones

commented

At least it's only a client crash, but it could still crash nearby users.

Maybe just try-catch the renderBolt function? It seems like the simplest way to handle the problem. Could that leave the tessellator in a bad state though? Alternatively, you could just max lightningCount to 20 or so.

commented

lol try catching is terrible terrible terrible idea. not only is it slow it's going to leave the tess as well as native memory in a wobbly state
Yea capping the count is the best way to go

commented

Forgot how low-level the tess was, oops.

commented

Wouldn't that leave lightning particles unrendered? Perhaps break up the particles into batches to be rendered, which renders all of them but doesn't make the buffer overflow.

commented

still laggy as hell on my intel but shouldn't crash