Emerald-Craft

Emerald-Craft

7.8k Downloads

关于与作物盛景冲突的问题

fforepretty opened this issue · 1 comments

commented

错误报告-2023-8-31_21.57.19.zip
屏幕截图 2023-08-31 215702

本来都已经把mod删了不想管了,我现在又把mod给你装了回去复现问题,希望你能解决吧。

commented

I'll explain what happened in English. Emerald Craft mod uses DeferredRegister and RegistryObject to register seeds and add it as chicken's food when Chicken class is loaded (calling method):

@Mixin(Chicken.class)
public class ChickenEntityMixin {
	@Shadow @Final @Mutable
	private static Ingredient FOOD_ITEMS;

	@Inject(method = "<clinit>", at = @At(value = "FIELD", target = "Lnet/minecraft/world/entity/animal/Chicken;FOOD_ITEMS:Lnet/minecraft/world/item/crafting/Ingredient;", shift = At.Shift.AFTER))
	private static void addECSeeds(CallbackInfo ci) {
		FOOD_ITEMS = Ingredient.of(ArrayUtils.addAll(
				FOOD_ITEMS.getItems(),
				new ItemStack(ECItems.CHILI_SEED),
				new ItemStack(ECItems.CABBAGE_SEED)
		));
	}
}

But Croptopia make the method of it called far too early, even when firing RegisterEvent(in CroptopiaForge.java).

The main error message is:

[Render thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: null
	Index: 5
	Listeners:
		0: NORMAL
		1: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@4206c7fd handleEvent(Lnet/minecraftforge/registries/RegisterEvent;)V
		2: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@45b57af3 handleEvent(Lnet/minecraftforge/registries/RegisterEvent;)V
		3: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@31751767 handleEvent(Lnet/minecraftforge/registries/RegisterEvent;)V
		4: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@439ac72f handleEvent(Lnet/minecraftforge/registries/RegisterEvent;)V
		5: ASM: class com.epherical.croptopia.CroptopiaForge$RegistryEvents onRegister(Lnet/minecraftforge/registries/RegisterEvent;)V
java.lang.ExceptionInInitializerError
	at TRANSFORMER/[email protected]/com.epherical.croptopia.CroptopiaForge$RegistryEvents.onRegister(CroptopiaForge.java:230)
	at TRANSFORMER/[email protected]/com.epherical.croptopia.__RegistryEvents_onRegister_RegisterEvent.invoke(.dynamic)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:107)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.lambda$postEventWithWrapInModOrder$33(ModLoader.java:346)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModList.forEachModInOrder(ModList.java:227)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.postEventWithWrapInModOrder(ModLoader.java:344)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.postEventWrapContainerInModOrder(ModLoader.java:337)
	at TRANSFORMER/[email protected]/net.minecraftforge.registries.GameData.postRegisterEvents(GameData.java:342)
	at TRANSFORMER/[email protected]/net.minecraftforge.common.ForgeStatesProvider.lambda$new$4(ForgeStatesProvider.java:25)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.handleInlineTransition(ModLoader.java:217)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$19(ModLoader.java:209)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:209)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$13(ModLoader.java:183)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:183)
	at TRANSFORMER/[email protected]/net.minecraftforge.client.loading.ClientModLoader.lambda$begin$1(ClientModLoader.java:70)
	at TRANSFORMER/[email protected]/net.minecraftforge.client.loading.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:90)
	at TRANSFORMER/[email protected]/net.minecraftforge.client.loading.ClientModLoader.begin(ClientModLoader.java:70)
	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.<init>(Minecraft.java:459)
	at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:182)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:108)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:78)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
	at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at oolloo.jlw.Wrapper.invokeMain(Wrapper.java:60)
	at oolloo.jlw.Wrapper.main(Wrapper.java:53)
Caused by: java.lang.NullPointerException: Registry Object not present: emeraldcraft:chili_seed
	at java.base/java.util.Objects.requireNonNull(Objects.java:334)
	at TRANSFORMER/[email protected]/net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:204)
	at TRANSFORMER/[email protected]/com.hexagram2021.emeraldcraft.common.register.ECItems$ItemEntry.m_5456_(ECItems.java:457)
	at TRANSFORMER/[email protected]/net.minecraft.world.item.ItemStack.<init>(ItemStack.java:147)
	at TRANSFORMER/[email protected]/net.minecraft.world.item.ItemStack.<init>(ItemStack.java:143)
	at TRANSFORMER/[email protected]/net.minecraft.world.item.ItemStack.<init>(ItemStack.java:127)
	at TRANSFORMER/[email protected]/net.minecraft.world.entity.animal.Chicken.handler$dii000$addECSeeds(Chicken.java:1024)
	at TRANSFORMER/[email protected]/net.minecraft.world.entity.animal.Chicken.<clinit>(Chicken.java:41)
	... 46 more