Chisels & Bits - For Fabric

Chisels & Bits - For Fabric

2M Downloads

[1.18.2-1.2.114][Server][Crash] C&B Items use client class to return item name - Attempted to load class net/minecraft/client/Minecraft for invalid dist DEDICATED_SERVER

TigerWalts opened this issue ยท 2 comments

commented
  • MC Version: 1.18.2
  • C&B Version: 1.18.2-1.2.114
  • Do You have Optifine: No
  • Modpack: StoneBlock 3 - 1.0.1

This crash was triggered by a Chisels and Bits Magnifying glass inside a storage container connected to an Applied Energistics Storage Grid.

When Applied Energistics tries to get the item stack's display name it results in the item trying to load net/minecraft/client/Minecraft:

java.lang.RuntimeException: Attempted to load class net/minecraft/client/Minecraft for invalid dist DEDICATED_SERVER
	at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:57) ~[fmlloader-1.18.2-40.1.84.jar%2317!/:1.0] {}
	...
	at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {}
	at mod.chiselsandbits.item.MagnifyingGlassItem.m_7626_(MagnifyingGlassItem.java:33) ~[ChiselsBits-forge-1.18.2-1.2.114-universal.jar%2369!/:1.2.114] {re:classloading,pl:epic_rei_lmao:B}
	at net.minecraft.world.item.ItemStack.m_41786_(ItemStack.java:593) ~[server-1.18.2-20220404.173914-srg.jar%23240!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:forge:itemstack,re:classloading,pl:epic_rei_lmao:B,pl:accesstransformer:B,xf:fml:forge:itemstack,pl:mixin:APP:kubejs-common.mixins.json:ItemStackMixin,pl:mixin:APP:placebo.mixins.json:ItemStackMixin,pl:mixin:APP:ae2wtlib.mixins.json:Restock,pl:mixin:APP:itemfilters-common.mixins.json:ItemStackMixin,pl:mixin:A}
	at appeng.util.Platform.getItemDisplayName(Platform.java:332) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.api.stacks.AEItemKey.<init>(AEItemKey.java:59) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:mixin,re:classloading,pl:epic_rei_lmao:B}
	at appeng.api.stacks.AEItemKey.of(AEItemKey.java:128) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:mixin,re:classloading,pl:epic_rei_lmao:B}
	at appeng.api.stacks.AEItemKey.of(AEItemKey.java:76) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:mixin,re:classloading,pl:epic_rei_lmao:B}
	at appeng.me.storage.ExternalStorageFacade$ItemHandlerFacade.getAvailableStacks(ExternalStorageFacade.java:258) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.me.storage.CompositeStorage$InventoryCache.update(CompositeStorage.java:119) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.me.storage.CompositeStorage.onTick(CompositeStorage.java:89) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.parts.storagebus.StorageBusPart.tickingRequest(StorageBusPart.java:264) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.me.service.TickManagerService.unsafeTickingRequest(TickManagerService.java:358) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.me.service.TickManagerService.tickQueue(TickManagerService.java:121) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.me.service.TickManagerService.tickLevelQueue(TickManagerService.java:93) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.me.service.TickManagerService.onLevelEndTick(TickManagerService.java:78) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.me.Grid.onLevelEndTick(Grid.java:262) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.hooks.ticking.TickHandler.onServerLevelTickEnd(TickHandler.java:282) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}
	at appeng.hooks.ticking.TickHandler.onLevelTick(TickHandler.java:248) ~[appliedenergistics2-forge-11.6.1-beta.jar%2344!/:11.6.1-beta] {re:classloading,pl:epic_rei_lmao:B}

I checked other items in the codebase and they do the same thing:

@Override
public @NotNull Component getName(final ItemStack stack)
{
if (Minecraft.getInstance().level == null)
{
return super.getName(stack);
}

commented

Encountering this too.

commented

possibly fixed: #1032 (comment)