lucaargolo / fabric-seasons-extras

A Minecraft mod that adds custom blocks and items to make your Fabric Seasons experience better.
Mozilla Public License 2.0
0 stars 10 forks source link

Crashes when iterating dye colors due to hardcoded array size #24

Open Linguardium opened 8 months ago

Linguardium commented 8 months ago

https://github.com/lucaargolo/fabric-seasons-extras/blob/e8fd13899e7752f39fd783bde121ef1a18ed1749/src/main/java/io/github/lucaargolo/seasonsextras/FabricSeasonsExtras.java#L74

Hardcoded array size

https://github.com/lucaargolo/fabric-seasons-extras/blob/e8fd13899e7752f39fd783bde121ef1a18ed1749/src/main/java/io/github/lucaargolo/seasonsextras/FabricSeasonsExtras.java#L100

Not hardcoded iteration limit

https://github.com/lucaargolo/fabric-seasons-extras/blob/e8fd13899e7752f39fd783bde121ef1a18ed1749/src/main/java/io/github/lucaargolo/seasonsextras/FabricSeasonsExtras.java#L103

ordinal id used to access hardcoded array entry. Breaking when enum modification is done by any other mod

IJuanTM commented 6 months ago

Can confirm, I added the "Dye Depot" mod, which adds new dye colors, to my mod pack, and it causes to to crash on launch due to this issue.

java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'seasonsextras'! at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388) at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33) at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:386) at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52) at fudge.notenoughcrashes.fabric.mixinhandlers.ModLoaders.fabricEntrypoints(ModLoaders.java:9) at net.minecraft.class_310.redirect$ldb000$notenoughcrashes$catchFabricInit(class_310.java:41032) at net.minecraft.class_310.<init>(class_310.java:458) at net.minecraft.client.main.Main.main(Main.java:211) at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 17 out of bounds for length 17 at io.github.lucaargolo.seasonsextras.FabricSeasonsExtras.onInitialize(FabricSeasonsExtras.java:105) at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:384) ... 8 more