RFTools

RFTools

74M Downloads

Server crash when flipping a scanned shape card

kerzenhans opened this issue ยท 5 comments

commented

Setup:
Pack: ATM3 v5.6
RFTools 7.15

what I did:
2 shape cards dim 10 20 20
1st card type scan and scanned with scanner.
Then inserted both cards into the composer. Before setting an axis clicking Flip-> crash.

After server restart using the composer resulted in another crash.

The Log is from a singleplayer test I did later to recreate.
http://www.candlekeep.de/temp/shapecardScanFlip.txt

commented

I can't open that url

commented

Now its clickable. Used Add link button which reformated the link.

commented

I think I found the cause for the out of bounds exception. Discrete coordinates and the y dimension beeing an even number.
As the flipY() needs a center to flip around. If I flip an Array of coordinates Y[-10,9] (dim 20) if becomes Y'[-9,10], hence the 10 would be out of bounds.

commented

Here's a new log from a dev environment that reflects the changes I just made:

java.lang.ArrayIndexOutOfBoundsException: 4000
	at mcjty.rftools.shapes.Formulas$FormulaScan.isInsideInternal(Formulas.java:156) ~[Formulas$FormulaScan.class:?]
	at mcjty.rftools.shapes.Formulas$FormulaScan.isInside(Formulas.java:179) ~[Formulas$FormulaScan.class:?]
	at mcjty.rftools.shapes.Formulas$FormulaComposition.isInside(Formulas.java:323) ~[Formulas$FormulaComposition.class:?]
	at mcjty.rftools.items.builder.ShapeCardItem.getRenderPositions(ShapeCardItem.java:664) ~[ShapeCardItem.class:?]
	at mcjty.rftools.shapes.ShapeDataManagerServer.handleWork(ShapeDataManagerServer.java:96) ~[ShapeDataManagerServer.class:?]
	at mcjty.rftools.ForgeEventHandlers.onWorldTick(ForgeEventHandlers.java:98) ~[ForgeEventHandlers.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_22_ForgeEventHandlers_onWorldTick_WorldTickEvent.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) [EventBus.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.onPreWorldTick(FMLCommonHandler.java:285) [FMLCommonHandler.class:?]
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:825) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741) [MinecraftServer.class:?]
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
commented

Yep, you were right. We assumed that valid coordinates always went from -k to k for some value k, so we just multiplied by -1 to flip, but sometimes valid coordinates go from -k to k-1. Anyway, it will be fixed in the next release.