Modular Routers

Modular Routers

33M Downloads

Crash caused by inspection filter with energy level

horsenit opened this issue ยท 4 comments

commented

Minecraft Version

1.12.2

Forge Version

14.23.5.2854

Mod Version

1.12.2-3.3.0-33

Describe your problem, including steps to reproduce it

Player Module with Inspection Filter with energy level matcher causing crashes on load. I can't reproduce as I don't know which item is causing the error, but from a brief look at the stack trace and code it seems like an item is reporting it can contain energy but that its max energy is 0, causing the crash.

[Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking block entity
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:773) ~[MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) ~[MinecraftServer.class:?]
	at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:279) ~[chd.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]
Caused by: java.lang.ArithmeticException: / by zero
	at java.math.BigDecimal.divideAndRound(Unknown Source) ~[?:1.8.0_231]
	at java.math.BigDecimal.divide(Unknown Source) ~[?:1.8.0_231]
	at java.math.BigDecimal.divide(Unknown Source) ~[?:1.8.0_231]
	at java.math.BigDecimal.divide(Unknown Source) ~[?:1.8.0_231]
	at me.desht.modularrouters.logic.filter.matchers.InspectionMatcher$InspectionSubject.asPercentage(InspectionMatcher.java:219) ~[InspectionMatcher$InspectionSubject.class:?]
	at me.desht.modularrouters.logic.filter.matchers.InspectionMatcher$InspectionSubject.getEnergyPercent(InspectionMatcher.java:171) ~[InspectionMatcher$InspectionSubject.class:?]
	at me.desht.modularrouters.logic.filter.matchers.InspectionMatcher$InspectionSubject.getValue(InspectionMatcher.java:146) ~[InspectionMatcher$InspectionSubject.class:?]
	at me.desht.modularrouters.logic.filter.matchers.InspectionMatcher$InspectionSubject.access$000(InspectionMatcher.java:127) ~[InspectionMatcher$InspectionSubject.class:?]
	at me.desht.modularrouters.logic.filter.matchers.InspectionMatcher$Comparison.matches(InspectionMatcher.java:94) ~[InspectionMatcher$Comparison.class:?]
	at me.desht.modularrouters.logic.filter.matchers.InspectionMatcher.matchItem(InspectionMatcher.java:42) ~[InspectionMatcher.class:?]
	at me.desht.modularrouters.logic.filter.Filter.test(Filter.java:72) ~[Filter.class:?]
	at me.desht.modularrouters.logic.compiled.CompiledModule.findItemToPull(CompiledModule.java:242) ~[CompiledModule.class:?]
	at me.desht.modularrouters.logic.compiled.CompiledModule.transferToRouter(CompiledModule.java:199) ~[CompiledModule.class:?]
	at me.desht.modularrouters.logic.compiled.CompiledPlayerModule.execute(CompiledPlayerModule.java:84) ~[CompiledPlayerModule.class:?]
	at me.desht.modularrouters.block.tile.TileEntityItemRouter.executeModules(TileEntityItemRouter.java:407) ~[TileEntityItemRouter.class:?]
	at me.desht.modularrouters.block.tile.TileEntityItemRouter.func_73660_a(TileEntityItemRouter.java:380) ~[TileEntityItemRouter.class:?]
	at net.minecraft.world.World.func_72939_s(World.java:1838) ~[amu.class:?]
	at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:613) ~[oo.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767) ~[MinecraftServer.class:?]
	... 4 more
commented

The item causing the problem is a Mekanism (1.12.2-9.8.3.390) Basic Fluid Tank.

commented

Can you try build 34 from https://jenkins.k-4u.nl/job/Modular%20Routers%201.12/ please? Should fix the crash.

The fluid tank shouldn't ever be reporting a max capacity of 0, but I've added some code to work around it (just treat such invalid tanks as empty).

commented

That fixed it. Thanks.

commented

Fixed in 7.0.2 release