CivMC / FactoryMod

Configurable factories for automating item production - Built for Paper 1.16.5
Other
0 stars 11 forks source link

Many factories run while chest is full or at 0% health #1

Closed AngrySoundTech closed 1 year ago

wingzero54 commented 2 years ago

@specificlanguage was doing a little testing and was seeing that some factories were indeed running while full, but it was only costing fuel and not wasting materials. Not sure if all factories were checked

wingzero54 commented 2 years ago

Reports are that the gold factory does keep wasting materials and running, so maybe we need to review and update the different factory types?

AngrySoundTech commented 1 year ago

Others have reported that factories also run at 0% health

dquist commented 1 year ago

Previous attempt at a fix: https://github.com/CivMC/FactoryMod/pull/28

Resulted in errors:

[18:30:29] [Server thread/ERROR]: Could not pass event BlockRedstoneEvent to FactoryMod v3.0.0-SNAPSHOT
java.lang.ThreadDeath: null
    at java.lang.Thread.stop(Unknown Source) ~[?:?]
    at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:960) ~[paper-1.18.2.jar:git-Paper-388]
    at net.minecraft.server.dedicated.DedicatedServer.stopServer(DedicatedServer.java:803) ~[paper-1.18.2.jar:git-Paper-388]
    at net.minecraft.server.MinecraftServer.close(MinecraftServer.java:932) ~[paper-1.18.2.jar:git-Paper-388]
    at org.spigotmc.WatchdogThread.run(WatchdogThread.java:234) ~[paper-1.18.2.jar:git-Paper-388]
[18:30:29] [Server thread/ERROR]: Main thread terminated by WatchDog due to hard crash
java.lang.ThreadDeath: null
    at java.lang.Thread.stop(Unknown Source) ~[?:?]
    at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:960) ~[paper-1.18.2.jar:git-Paper-388]
    at net.minecraft.server.dedicated.DedicatedServer.stopServer(DedicatedServer.java:803) ~[paper-1.18.2.jar:git-Paper-388]
    at net.minecraft.server.MinecraftServer.close(MinecraftServer.java:932) ~[paper-1.18.2.jar:git-Paper-388]
    at org.spigotmc.WatchdogThread.run(WatchdogThread.java:234) ~[paper-1.18.2.jar:git-Paper-388]

and

[18:29:28] [Server thread/INFO]: [FactoryMod] Activating Diamond Pickaxe Smith at Location{world=CraftWorld{name=world},}, because of Redstone
[18:29:28] [Server thread/INFO]: [FactoryMod] Deactivating Diamond Pickaxe Smith at Location{world=CraftWorld{name=world},}
[18:29:28] [Server thread/INFO]: [FactoryMod] Activating Diamond Pickaxe Smith at Location{world=CraftWorld{name=world},}, because of Redstone
[18:29:28] [Server thread/INFO]: [FactoryMod] Deactivating Diamond Pickaxe Smith at Location{world=CraftWorld{name=world},}
[18:29:28] [Server thread/INFO]: [FactoryMod] Activating Diamond Pickaxe Smith at Location{world=CraftWorld{name=world},}, because of Redstone
[18:29:28] [Server thread/INFO]: [FactoryMod] Deactivating Diamond Pickaxe Smith at Location{world=CraftWorld{name=world}}
dquist commented 1 year ago

From convo with Diet_Cola:

so the cause of them running at 0% health is down to the massive if statement inside FurnCraftChestFactory around here https://github.com/CivMC/FactoryMod/blob/master/paper/src/main/java/com/github/igotyou/FactoryMod/factories/FurnCraftChestFactory.java#L267 then the running while full part is down to an issue w/ a utility method inside civmodcore, possibly this one: https://github.com/CivMC/CivModCore/blob/master/paper/src/main/java/vg/civcraft/mc/civmodcore/inventory/items/ItemMap.java#L508 lemme search my screenshots to find an easily reproduceable setup for the full inv one

ProgrammerDan commented 1 year ago

One thing that jumps out at me looking at the civmodcore item map methods is a lot of stuff seems to quietly fail; merges just "return" if they aren't able to succeed, so I could see the resulting itemmap being <= 36 items in size if the itemmap merges just ... didn't work. There would be no signaling, and the factorymod code would chug along happily.

Which seems to be what is reported, and I'd strongly suspect that's what is happening. Ideally those methods should be somewhat noisy if they fail, or there should be a version of them that is noisy on failure. But, in their current state it would be hard to identify the reason for failure as there are several layers each being quiet.