BCLib

BCLib

33M Downloads

[Bug] Server Crash: bclib mod calls client-only class resulting in NoClassDefFoundError

kitamaruramito opened this issue · 0 comments

commented

What happened?

When running a Mohist 1.20.1-923 server with the bclib mod (version 3.0.14_mapped_srg_1.20.1), the server crashes during an anvil operation. The error log indicates that a client-only class (net/minecraft/client/Minecraft) is being loaded on the server, which results in a java.lang.NoClassDefFoundError. It appears that the issue originates from the AnvilRecipe.craft method in bclib, which is erroneously invoking client-side code in a server environment.

Steps to Reproduce:

Set up a Mohist 1.20.1-923 server and install the bclib mod (version 3.0.14_mapped_srg_1.20.1).

Perform an anvil-related operation (such as item repair or crafting using the anvil).

Observe the server crash and review the error log.

BCLib

3.0.14

WorldWeaver

N/A

Fabric API

No response

Fabric Loader

No response

Minecraft

1.20.1

Relevant log output

[11:01:00] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: KillMasterAGS取得了进度[一柄好锤]
[11:01:02] [Server thread/INFO] [Console]: §x10§x秒§x后§x将§x清§x理§x掉§x落§x物§x和§x怪§x物§x, §x请§x留§x意§x物§x品§x不§x要§x被§x服§x务§x器§x娘§x吃§x掉
[11:01:08] [Server thread/ERROR] [net.minecraft.server.MinecraftServer]: Encountered an unexpected exception
java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft
	at org.betterx.bclib.recipes.AnvilRecipe.craft(AnvilRecipe.java:147) ~[bclib-3.0.14_mapped_srg_1.20.1.jar%23539!/:?]
	at net.minecraft.world.inventory.AnvilMenu.handler$zce000$bclib$bcl_onTakeAnvilOutput(AnvilMenu.java:598) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.world.inventory.AnvilMenu.m_142365_(AnvilMenu.java) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.world.inventory.ItemCombinerMenu$2.m_142406_(ItemCombinerMenu.java:63) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.world.inventory.AbstractContainerMenu.m_150418_(AbstractContainerMenu.java:542) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
	at net.minecraft.world.inventory.AbstractContainerMenu.m_150430_(AbstractContainerMenu.java:540) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.world.inventory.AbstractContainerMenu.m_150399_(AbstractContainerMenu.java:377) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.m_5914_(ServerGamePacketListenerImpl.java:2565) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.m_5797_(ServerboundContainerClickPacket.java:56) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.m_5797_(ServerboundContainerClickPacket.java:12) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.network.protocol.PacketUtils.m_263899_(PacketUtils.java:25) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.TickTask.run(TickTask.java:18) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:151) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:1026) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:176) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:124) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.MinecraftServer.m_129961_(MinecraftServer.java:1009) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.MinecraftServer.m_7245_(MinecraftServer.java:1003) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.util.thread.BlockableEventLoop.m_18701_(BlockableEventLoop.java:134) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.MinecraftServer.m_130012_(MinecraftServer.java:989) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:914) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:286) ~[server-1.20.1-20230612.114412-srg.jar%23328!/:?]
	at java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.Minecraft
	at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:157) ~[securejarhandler-mohist-2.1.11.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
	... 25 more
[11:01:08] [Server thread/FATAL] [net.minecraftforge.common.ForgeMod]: Preparing crash report with UUID 1a3897d1-7f38-43a2-ba8c-f42cdf436228
[11:01:08] [Server thread/ERROR] [net.minecraft.server.MinecraftServer]: 小小墨已经将服务器崩溃日志存放在 /srv/miragemc/./crash-reports/crash-2025-04-04_11.01.08-server.txt,请注意!
[11:01:08] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server
[11:01:08] [Server thread/INFO] [com.mohistmc.plugins.Main]: [Mohist] 小小墨正在与 Mohist v1.20.1 插件断开连接
[11:01:08] [Server thread/INFO] [com.bekvon.bukkit.residence.Residence]: [Residence] 小小墨正在与 Residence v5.1.7.3 插件断开连接
[11:01:08] [Server thread/INFO] [Console]: [Residence] Disabled!
[11:01:08] [Server thread/INFO] [de.dustplanet.silkspawners.SilkSpawners]: [SilkSpawners] 小小墨正在与 SilkSpawners v8.2.0 插件断开连接
[11:01:08] [Server thread/INFO] [net.coreprotect.CoreProtect]: [CoreProtect] 小小墨正在与 CoreProtect v22.4 插件断开连接
[11:01:08] [Server thread/INFO] [Minecraft]: [CoreProtect] Finishing up data logging. Please wait...
[11:01:09] [Server thread/INFO] [Minecraft]: [CoreProtect] Success! Disabled CoreProtect v22.4
[11:01:09] [Server thread/INFO] [EssentialsSpawn]: 小小墨正在与 EssentialsSpawn v2.21.1-dev+5-dabe687 插件断开连接
[11:01:09] [Server thread/INFO] [cn.handyplus.menu.PlayerMenu]: [PlayerMenu] 小小墨正在与 PlayerMenu v1.5.9 插件断开连接
[11:01:09] [Server thread/INFO] [su.nexmedia.engine.NexEngine]: [NexEngine] 小小墨正在与 NexEngine v2.2.12 插件断开连接
[11:01:09] [Server thread/INFO] [com.onarandombox.MultiversePortals.MultiversePortals]: [Multiverse-Portals] 小小墨正在与 Multiverse-Portals v4.2.3 插件断开连接
[11:01:09] [Server thread/INFO] [dev.geco.gsit.GSitMain]: [GSit] 小小墨正在与 GSit v2.2.1 插件断开连接
[11:01:09] [Server thread/INFO] [com.sk89q.worldguard.WorldGuard]: [WorldGuard] Unregistering session handler dev.geco.gsit.link.worldguard.RegionFlagHandler
[11:01:09] [Server thread/INFO] [Console]: [GSit] The plugin was successfully disabled.
[11:01:09] [Server thread/INFO] [me.neznamy.tab.platforms.bukkit.BukkitTAB]: [TAB] 小小墨正在与 TAB v5.1.0 插件断开连接
[11:01:09] [Server thread/INFO] [Console]: [TAB] §xDisabled in 4ms
[11:01:09] [Server thread/INFO] [fr.andross.banitem.BanItem]: [BanItem] 小小墨正在与 BanItem v3.6 插件断开连接
[11:01:09] [Server thread/INFO] [com.bergerkiller.bukkit.mw.MyWorlds]: [My_Worlds] 小小墨正在与 My_Worlds v1.21.1-v1 插件断开连接
[11:01:09] [Server thread/INFO] [com.bergerkiller.bukkit.mw.MyWorlds]: [My_Worlds] My_Worlds disabled!
[11:01:09] [Server thread/INFO] [com.extendedclip.deluxemenus.DeluxeMenus]: [DeluxeMenus] 小小墨正在与 DeluxeMenus v1.14.1-DEV-178 插件断开连接
[11:01:09] [Server thread/INFO] [EssentialsProtect]: 小小墨正在与 EssentialsProtect v2.21.1-dev+5-dabe687 插件断开连接
[11:01:09] [Server thread/INFO] [com.handy.playertitle.PlayerTitle]: [PlayerTitle] 小小墨正在与 PlayerTitle v4.5.2 插件断开连接
[11:01:09] [Server thread/INFO] [me.crylonz.MobsManager]: [MobsManager] 小小墨正在与 MobsManager v5.5.0 插件断开连接
[11:01:09] [Server thread/INFO] [Minecraft]: [MobsManager] is disabled !
[11:01:09] [Server thread/INFO] [org.worldlisttrashcan.WorldListTrashCan]: [WorldListTrashCan] 小小墨正在与 WorldListTrashCan v6.1.1 插件断开连接
[11:01:09] [Server thread/INFO] [com.onarandombox.MultiverseCore.MultiverseCore]: [Multiverse-Core] 小小墨正在与 Multiverse-Core v4.3.14 插件断开连接
[11:01:09] [Server thread/INFO] [com.sk89q.worldguard.bukkit.WorldGuardPlugin]: [WorldGuard] 小小墨正在与 WorldGuard v7.0.9+5934e49 插件断开连接
[11:01:09] [Server thread/INFO] [com.sk89q.worldguard.WorldGuard]: [WorldGuard] Shutting down executor and cancelling any pending tasks...
[11:01:09] [Server thread/INFO] [com.janboerman.invsee.spigot.InvseePlusPlus]: [InvSee++] 小小墨正在与 InvSeePlusPlus v0.29.20 插件断开连接
[11:01:09] [Server thread/INFO] [com.bergerkiller.bukkit.common.internal.CommonPlugin]: [BKCommonLib] 小小墨正在与 BKCommonLib v1.21.1-v1 插件断开连接
[11:01:11] [Server thread/INFO] [Essentials]: 小小墨正在与 Essentials v2.21.1-dev+5-dabe687 插件断开连接
[11:01:11] [Server thread/INFO] [net.milkbowl.vault.Vault]: [Vault] [Economy] Essentials Economy unhooked.
[11:01:11] [Server thread/ERROR] [Essentials]: 这可以让你的服务器立即重载。但你为什么要这样做呢?请不要指望EssentialsX团队会提供使用/reload命令后发生问题的任何支持。
[11:01:11] [Server thread/INFO] [com.sk89q.worldedit.bukkit.WorldEditPlugin]: [WorldEdit] 小小墨正在与 WorldEdit v7.2.15+6463-5ca4dff 插件断开连接
[11:01:11] [Server thread/INFO] [com.sk89q.worldedit.extension.platform.PlatformManager]: Unregistering com.sk89q.worldedit.bukkit.BukkitServerInterface from WorldEdit
[11:01:11] [Server thread/INFO] [de.dark.mobheads.MobHeads]: [MobHeads] 小小墨正在与 MobHeads v1.1 插件断开连接
[11:01:11] [Server thread/INFO] [net.milkbowl.vault.Vault]: [Vault] 小小墨正在与 Vault v1.7.3-b131 插件断开连接
[11:01:11] [Server thread/INFO] [cc.xhmc.onlinereward.MainClass]: [OnlineReward-NEXT] 小小墨正在与 OnlineReward-NEXT v1.5 插件断开连接
[11:01:11] [Server thread/INFO] [Minecraft]: [OnlineReward-NEXT] 插件已卸载,感谢使用,建议/反馈联系QQ:476915861
[11:01:11] [Server thread/INFO] [qq3154311518.Lore.BukkitMain]: [Lore] 小小墨正在与 Lore v1.2 插件断开连接
[11:01:11] [Server thread/INFO] [me.arasple.mc.trchat.taboolib.platform.BukkitPlugin]: [TrChat] 小小墨正在与 TrChat v2.2.2 插件断开连接
[11:01:14] [Server thread/INFO] [studio.trc.bukkit.litesignin.Main]: [LiteSignIn] 小小墨正在与 LiteSignIn v1.8.4.2 插件断开连接
[11:01:14] [Server thread/INFO] [me.clip.placeholderapi.PlaceholderAPIPlugin]: [PlaceholderAPI] Unregistered placeholder expansion litesignin
[11:01:14] [Server thread/INFO] [me.clip.placeholderapi.PlaceholderAPIPlugin]: [PlaceholderAPI] Reason: required plugin LiteSignIn was disabled.
[11:01:14] [Server thread/INFO] [Console]: LiteSignIn >>> Async thread stopped.
[11:01:14] [Server thread/INFO] [Console]: LiteSignIn >>> Database SQLite disconnected.
[11:01:14] [Server thread/INFO] [me.danjono.inventoryrollback.InventoryRollback]: [InventoryRollback] 小小墨正在与 InventoryRollback v1.4.0 插件断开连接
[11:01:14] [Server thread/INFO] [com.comphenix.protocol.ProtocolLib]: [ProtocolLib] 小小墨正在与 ProtocolLib v5.3.0 插件断开连接
[11:01:14] [Server thread/INFO] [drew6017.lr.main.LaggRemover]: [LaggRemover] 小小墨正在与 LaggRemover v2.0.6 插件断开连接
[11:01:14] [Server thread/INFO] [drew6017.lr.main.LaggRemover]: [LaggRemover] LaggRemover has been disabled!
[11:01:14] [Server thread/INFO] [su.nightexpress.nightcore.NightCore]: [nightcore] 小小墨正在与 nightcore v2.7.3.4 插件断开连接
[11:01:14] [Server thread/INFO] [net.Zrips.CMILib.CMILib]: [CMILib] 小小墨正在与 CMILib v1.5.4.0 插件断开连接
[11:01:14] [Server thread/INFO] [com.traumsoft.ultimatetimber.Main]: [UltimateTimber] 小小墨正在与 UltimateTimber v1.1 插件断开连接
[11:01:14] [Server thread/INFO] [me.clip.placeholderapi.PlaceholderAPIPlugin]: [PlaceholderAPI] 小小墨正在与 PlaceholderAPI v2.11.6 插件断开连接
[11:01:14] [Server thread/INFO] [org.MatthiasSchülski.EasyRTP.EasyRTP]: [EasyRTP] 小小墨正在与 EasyRTP v1.2 插件断开连接
[11:01:14] [Server thread/INFO] [su.kukecdk.KukeCDK]: [KukeCDK] 小小墨正在与 KukeCDK v1.1-SNAPSHOT 插件断开连接
[11:01:14] [Server thread/INFO] [net.myunco.servermonitor.ServerMonitor]: [ServerMonitor] 小小墨正在与 ServerMonitor v1.5.0 插件断开连接
[11:01:14] [Server thread/INFO] [Console]: [ServerMonitor] 已卸载.
[11:01:14] [Server thread/INFO] [ml.mcos.liteitemshow.LiteItemShow]: [LiteItemShow] 小小墨正在与 LiteItemShow v1.1.1 插件断开连接
[11:01:14] [Server thread/INFO] [me.lucko.luckperms.bukkit.loader.BukkitLoaderPlugin]: [LuckPerms] 小小墨正在与 LuckPerms v5.4.158 插件断开连接
[11:01:14] [Server thread/INFO] [me.lucko.luckperms.bukkit.loader.BukkitLoaderPlugin]: [LuckPerms] Starting shutdown process...
[11:01:14] [Server thread/INFO] [me.lucko.luckperms.bukkit.loader.BukkitLoaderPlugin]: [LuckPerms] Closing storage...
[11:01:14] [Server thread/INFO] [me.lucko.luckperms.bukkit.loader.BukkitLoaderPlugin]: [LuckPerms] Goodbye!
[11:01:14] [Server thread/INFO] [cn.huohuas001.huHoBot.HuHoBot]: [HuHoBot] 小小墨正在与 HuHoBot v1.2.2 插件断开连接
[11:01:14] [Server thread/INFO] [xyz.jpenilla.minimotd.bukkit.MiniMOTDPlugin]: [MiniMOTD] 小小墨正在与 MiniMOTD v2.1.5 插件断开连接
[11:01:14] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving players
[11:01:14] [Server thread/INFO] [net.minecraft.server.network.ServerGamePacketListenerImpl]: KillMasterAGS lost connection: Server closed
[11:01:14] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: KillMasterAGS left the game.
[11:01:14] [Server thread/INFO] [net.minecraft.server.network.ServerGamePacketListenerImpl]: Buisson53 lost connection: Server closed
[11:01:14] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Buisson53 left the game.
[11:01:14] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving worlds
[11:01:30] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[world]'/minecraft:overworld 中的区块
[11:01:30] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[the_end]'/minecraft:the_end 中的区块
[11:01:32] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[world]'/minecraft:the_nether 中的区块
[11:01:32] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[world]'/aether:the_aether 中的区块
[11:01:32] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[Shengcun]'/minecraft:shengcun 中的区块
[11:01:32] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[flat]'/minecraft:flat 中的区块
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[Ziyuan]'/minecraft:ziyuan 中的区块
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[mao_flat]'/minecraft:mao_flat 中的区块
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[world]'/minecraft:aether_the_aether_normal 中的区块
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[nether]'/minecraft:nether 中的区块
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: 正在保存世界 'ServerLevel[spawn]'/minecraft:spawn 中的区块
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (world): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (the_aether): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (Shengcun): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (flat): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (Ziyuan): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (mao_flat): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (the_aether): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage (spawn): All chunks are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: ThreadedAnvilChunkStorage: All dimensions are saved
[11:01:33] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving usercache.json
[11:01:33] [Server thread/INFO] [Framework]: Unloading server configs...
[11:01:33] [Server thread/INFO] [Framework]: Sending config unload event for refurbished_furniture.server.toml
[11:01:34] [Server thread/INFO] [Framework]: Finished unloading server configs

Other Mods

(BetterEnd)