Shield Size
Cobbs3 opened this issue ยท 10 comments
Due to a lack of mods in 1.7.10 that have force fields, I found my way to RF tools shield system. I noticed in the config file that you could increase the size of the force fields above 256, however when you try to make one that is bigger than 256 with that setting increased it crashes the game.
The error is:
Description: Exception in server tick loop
java.lang.StackOverflowError: Exception in server tick loop
at java.util.HashMap.getNode(Unknown Source)
at java.util.HashMap.containsKey(Unknown Source)
at java.util.HashSet.contains(Unknown Source)
at mcjty.rftools.blocks.shield.ShieldTEBase.findTemplateBlocks(ShieldTEBase.java:674)
at mcjty.rftools.blocks.shield.ShieldTEBase.findTemplateBlocks(ShieldTEBase.java:679)
at mcjty.rftools.blocks.shield.ShieldTEBase.findTemplateBlocks(ShieldTEBase.java:679)
at mcjty.rftools.blocks.shield.ShieldTEBase.findTemplateBlocks(ShieldTEBase.java:679)
at mcjty.rftools.blocks.shield.ShieldTEBase.findTemplateBlocks(ShieldTEBase.java:679)
at mcjty.rftools.blocks.shield.ShieldTEBase.findTemplateBlocks(ShieldTEBase.java:679)
at mcjty.rftools.blocks.shield.ShieldTEBase.findTemplateBlocks(ShieldTEBase.java:679)
The: at mcjty.rftools.blocks.shield.ShieldTEBase.findTemplateBlocks(ShieldTEBase.java:679)
repeats until the end of the crash report
Hope you are able to fix this as the shield system is awesome and I would love to be able to use it for a proper force field around my base
I'll check this out but note the tier2 and tier3 shields have higher limits (4 times for tier2 and 16 times for tie3).
Didn't mean to press that button...
I have had a look through the code on the ShieldTeBase and in the find template blocks method, it seems that the coordinate set being used there is of the type hash set which implements a hashmap which has a set size... I am not entirely sure if this is actually a fix that can be done on the lib side or this side but it might be possible to increase the size of the hashmap to equal that of the value in the config and as you say the tier 3 is 16x bigger so 16x that in the config.
Hope this narrows the problem down a bit
I have attempted replacing the Set with an ArrayList... doing this removes part of the error however it still seems to be giving an unknown source to it which makes little sense as what is being given as a parameter for the .contains method is defined on the line above it with the initialization of the Coordinate registered as c
-Edit:
It seems that for whatever reason the looping method to register the shield blocks does not end apparently that is a cause of the Unknown Source thing... I am just unsure as to why it only breaks when there are more than the default
What exactly is the shape of the shield you want to make? The real problem is a stack overflow which indicates the recursion goes to deep. That can happen if you happen to have a really long shield. I think I'm going to rewrite the routine to avoid recursion. That should help with this problem.
Thank you for taking the time to attempt the fix... it seems to work to some extent however it throws this error if the shield is quite a large as mine it seems to do it with the tier 4 shield even with default config values set the error is
java.io.IOException: Packet was larger than I expected, found 111643 bytes extra whilst reading packet 5
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:263) ~[ByteToMessageDecoder.class:?]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:147) ~[ByteToMessageDecoder.class:?]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [ByteToMessageDecoder.class:?]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149) [ReadTimeoutHandler.class:?]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100) [AbstractNioByteChannel$NioByteUnsafe.class:?]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480) [NioEventLoop.class:?]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [NioEventLoop.class:?]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [NioEventLoop.class:?]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_51]
it does not happen with small shields only big ones...
https://gyazo.com/527f9a18fa57176bce49beef62b670a1
There is a link to a picture of my base with the shield to give you an example of how I intend to use it
Yes, I can confirm that the error does not occur in singleplayer no matter the size of shield. Though I have noticed something else perhaps a little more worrying... occasionally when I turn the shield off... if part of it is unloaded chunks it remains on, and is no longer controlled by the shield.
I feel it may be related to this other issue which is when I close out of the world and turn it back on if shield blocks were active when I log out they seem to be permanently stuck where they were.