Crash from modulo by 0 in EnchancementUtil.java line 74
ElKaribooSama opened this issue ยท 4 comments
Mod version
Enchancement 1.20-7
A description of the issue
The crash was caused by an arrow shot by a skeleton when it hit the player the server crashed because of a division by 0
here is the stack trace:
Description: Ticking entity
java.lang.ArithmeticException: / by zero
at moriyashiine.enchancement.common.util.EnchancementUtil.getReplacement(EnchancementUtil.java:74)
at net.minecraft.class_1890.localvar$bpf000$enchancement$disableDisallowedEnchantments(class_1890.java:3524)
at net.minecraft.class_1890.method_8214(class_1890.java)
at net.minecraft.class_5642.method_522(class_5642.java:67)
at net.minecraft.class_120.method_521(class_120.java:31)
at net.minecraft.class_120.apply(class_120.java:20)
at net.minecraft.class_131.method_595(class_131.java:65)
at net.minecraft.class_117.method_514(class_117.java:14)
at net.minecraft.class_77.method_433(class_77.java:33)
at net.minecraft.class_85$1.method_426(class_85.java:59)
at net.minecraft.class_55.method_345(class_55.java:73)
at net.minecraft.class_55.method_341(class_55.java:96)
at net.minecraft.class_52.method_328(class_52.java:86)
at net.minecraft.class_83.method_433(class_83.java:35)
at net.minecraft.class_85$1.method_426(class_85.java:59)
at net.minecraft.class_55.method_345(class_55.java:73)
at net.minecraft.class_55.method_341(class_55.java:96)
at net.minecraft.class_52.method_328(class_52.java:86)
at net.minecraft.class_52.method_51880(class_52.java:95)
at net.minecraft.class_1309.method_16077(class_1309.java:1453)
at net.minecraft.class_1308.method_16077(class_1308.java:512)
at net.minecraft.class_1309.method_16080(class_1309.java:1410)
at net.minecraft.class_1309.method_6078(class_1309.java:1366)
at net.minecraft.class_1309.method_5643(class_1309.java:1222)
at net.minecraft.class_1665.mixinextras$bridge$method_5643$133(class_1665.java)
at net.minecraft.class_1665.wrapOperation$fdd000$spell_engine$wrapDamageEntity(class_1665.java:6899)
at net.minecraft.class_1665.method_7454(class_1665.java:374)
at net.minecraft.class_1676.method_7488(class_1676.java:153)
at net.minecraft.class_1665.method_5773(class_1665.java:227)
at net.minecraft.class_1667.method_5773(class_1667.java:104)
at net.minecraft.class_3218.method_18762(class_3218.java:739)
at net.minecraft.class_1937.method_18472(class_1937.java:480)
at net.minecraft.class_3218.method_31420(class_3218.java:385)
at net.minecraft.class_5574.method_31791(class_5574.java:54)
at net.minecraft.class_3218.method_18765(class_3218.java:353)
at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:897)
at net.minecraft.class_3176.method_3813(class_3176.java:283)
at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824)
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265)
at java.base/java.lang.Thread.run(Thread.java:842)
verifying if enchantments.size() is equal to 0 should fix the issue in EnchancementUtil.java:74
(first time making an issue sorry if bad)
Log or crash report
No response
We are on a custom modpack made with modrinth so we are still testing everything with around 160 mods (about half are just client side or qol) and here is the current enchancement config:
{
"disallowedEnchantments": [
"minecraft:aqua_affinity",
"minecraft:bane_of_arthropods",
"minecraft:binding_curse",
"minecraft:blast_protection",
"minecraft:depth_strider",
"minecraft:feather_falling",
"minecraft:fire_protection",
"minecraft:flame",
"minecraft:fortune",
"minecraft:frost_walker",
"minecraft:impaling",
"minecraft:knockback",
"minecraft:looting",
"minecraft:loyalty",
"minecraft:lure",
"minecraft:mending",
"minecraft:multishot",
"minecraft:piercing",
"minecraft:power",
"minecraft:projectile_protection",
"minecraft:protection",
"minecraft:punch",
"minecraft:quick_charge",
"minecraft:respiration",
"minecraft:sharpness",
"minecraft:smite",
"minecraft:soul_speed",
"minecraft:sweeping",
"minecraft:swift_sneak",
"minecraft:thorns",
"minecraft:unbreaking"
],
"invertedList": false,
"overhaulEnchantingTable": true,
"allowTreasureEnchantmentsInEnchantingTable": false,
"singleLevelMode": true,
"enchantmentLimit": 1,
"allowInfinityOnCrossbows": true,
"allTridentsHaveLoyalty": true,
"channelingIgnitesOnMelee": true,
"channelingWorksWhenNotThundering": true,
"fireAspectWorksAsFlintAndSteel": true,
"freeEnchantedBookMerging": true,
"luckOfTheSeaHasLure": true,
"negateEnderPearlDamage": true,
"safeChanneling": true,
"tridentsReturnFromVoid": true,
"weakerFireAspect": true,
"weakerGoldenApple": true,
"weakerPotions": true,
"weaponEnchantmentCooldownRequirement": 0.7,
"maxExtractingBlocks": 64,
"maxLumberjackBlocks": 1024,
"maxLumberjackHorizontalLength": 7,
"unbreakingChangesFlag": 0,
"enchantmentDescriptions": true,
"coloredEnchantmentNames": true
}
i dont remember changing anything so it might be just an enchant that isnt disalowed when it should
im going to try to find the enchants that are left and add it to the list. Is it intended to crash on unhandled enchants ?
No, it should only crash if there are no valid enchantments for any item in the game, but that should only ever happen if there are no enchantments registered to begin with, which I might need to fix. But since you do have enchantments registered, I think there's another problem happening