
reinorudo
Members-
Posts
4 -
Joined
-
Last visited
reinorudo's Achievements

Tree Puncher (2/8)
0
Reputation
-
its work! 登録していないことが原因でした。最初のコードは登録できていないようで、新しくクラスを作り@Mod.EventBusSubscriber(modid = LMMMaid.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE,value = Dist.CLIENT)このアノテーションで登録できたようです。このアノテーションを登録した際にはstaticを必ずつける必要があるようです。私はstaticが原因だと思っていたので苦労しました。 参考になったurl https://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html 自己解決しました。
-
This error caused by static operator. may be
-
@SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { if (event instanceof PlayerInteractEvent.EntityInteract) { PlayerEntity player = event.getPlayer(); Entity target = ((PlayerInteractEvent.EntityInteract) event).getTarget(); // FakePlayerを無視する(これは他のmodが発生させる場合があるため) if (player instanceof FakePlayer || target == null) { return; } // エンティティが特定の条件を満たす場合、CustomChatGUIを開く if (target instanceof LMMMaidEntity) { if (player.level.isClientSide()) { CustomChatGUI.openCustomChatGUI(player, (LMMMaidEntity) target); } event.setCanceled(true); event.setCancellationResult(ActionResultType.SUCCESS); }else{} } this code is working. but just start minecraft right crick event is not work anayway this topic is sloved! thank you!
-
Hello. I am creating a Minecraft mod that can talk with mob though LMM. I'm currently working on creating a part where clicking on a mob displays a custom GUI I've made. However, the event handling for this right-click isn't working properly. When I launch Minecraft, it throws an error during the initial loading. I suspect there might be an issue with the arguments in the onEntityInteract() method. Below is the code snippet: package com.LMMMaid.LMMMaidMod.reg; import com.LMMMaid.LMMMaidMod.LMMMaid; import com.LMMMaid.LMMMaidMod.chat.CustomChatGUI; import com.LMMMaid.LMMMaidMod.entity.LMMMaidEntity; import com.LMMMaid.LMMMaidMod.entity.render.LMMMaidEntityTypes; import net.minecraft.entity.Entity; import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ActionResultType; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DeferredWorkQueue; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; @Mod.EventBusSubscriber(modid = LMMMaid.MOD_ID, bus = Bus.MOD) public class CommonEventBusSubscriber { @SubscribeEvent public static void commonSetup(FMLCommonSetupEvent event){ mobAttributes(); } private static void mobAttributes(){ DeferredWorkQueue.runLater(()->{ GlobalEntityTypeAttributes.put(LMMMaidEntityTypes.LMM_MAID.get(), LMMMaidEntity.registerAttributes().build()); }); } @SubscribeEvent public static void onEntityInteract(PlayerInteractEvent.EntityInteract event) { PlayerEntity player = event.getPlayer(); Entity target = event.getTarget(); // FakePlayerを無視する(これは他のmodが発生させる場合があるため) if (player instanceof FakePlayer || target == null) { return; } // エンティティが特定の条件を満たす場合、CustomChatGUIを開く if (target instanceof LMMMaidEntity) { if (player.level.isClientSide()) { CustomChatGUI.openCustomChatGUI(player, (LMMMaidEntity) target); } event.setCanceled(true); event.setCancellationResult(ActionResultType.SUCCESS); }else{} } } Furthermore, the function to display the GUI is implemented in the file with the GUI as follows: public static void openCustomChatGUI(PlayerEntity player ,LMMMaidEntity target ) { Minecraft.getInstance().setScreen(new CustomChatGUI()); } And this is error code ---- Minecraft Crash Report ---- // Hi. I'm Minecraft, and I'm a crashaholic. Time: 23/11/27 1:56 Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:71) [?:?] {re:classloading} at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:174) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:508) [?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:tac.mixins.json:client.MinecraftStaticMixin,pl:mixin:APP:rubidium.mixins.json:features.gui.fast_fps_pie.MixinMinecraftClient,pl:mixin:APP:rubidium.mixins.json:features.options.MixinMinecraftClient,pl:mixin:APP:mixins.oculus.json:MixinMinecraft_PipelineManagement,pl:mixin:A,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft$$Lambda$4947/1813922009.run(Unknown Source) [?:?] {} at net.minecraft.util.Util.func_215077_a(Util.java:320) [?:?] {re:mixin,re:classloading,pl:mixin:APP:blue_skies.mixins.json:UtilMixin,pl:mixin:A} at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:504) [?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:tac.mixins.json:client.MinecraftStaticMixin,pl:mixin:APP:rubidium.mixins.json:features.gui.fast_fps_pie.MixinMinecraftClient,pl:mixin:APP:rubidium.mixins.json:features.options.MixinMinecraftClient,pl:mixin:APP:mixins.oculus.json:MixinMinecraft_PipelineManagement,pl:mixin:A,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft$$Lambda$4731/1239821079.accept(Unknown Source) [?:?] {} at net.minecraft.client.gui.ResourceLoadProgressGui.func_230430_a_(ResourceLoadProgressGui.java:113) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:481) [?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:tac.mixins.json:client.GameRendererMixin,pl:mixin:APP:rubidium.mixins.json:core.matrix.MixinGameRenderer,pl:mixin:APP:mixins.oculus.json:GameRendererAccessor,pl:mixin:APP:mixins.oculus.json:MixinGameRenderer,pl:mixin:APP:mixins.oculus.json:MixinModelViewBobbing,pl:mixin:APP:mixins.oculus.json:MixinTweakFarPlane,pl:mixin:APP:mixins.oculus.json:MixinGameRenderer_NightVisionCompat,pl:mixin:A,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:977) [?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:tac.mixins.json:client.MinecraftStaticMixin,pl:mixin:APP:rubidium.mixins.json:features.gui.fast_fps_pie.MixinMinecraftClient,pl:mixin:APP:rubidium.mixins.json:features.options.MixinMinecraftClient,pl:mixin:APP:mixins.oculus.json:MixinMinecraft_PipelineManagement,pl:mixin:A,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:tac.mixins.json:client.MinecraftStaticMixin,pl:mixin:APP:rubidium.mixins.json:features.gui.fast_fps_pie.MixinMinecraftClient,pl:mixin:APP:rubidium.mixins.json:features.options.MixinMinecraftClient,pl:mixin:APP:mixins.oculus.json:MixinMinecraft_PipelineManagement,pl:mixin:A,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {} at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37) [forge-1.16.5-36.2.39.jar:36.2] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$474/1711105800.call(Unknown Source) [forge-1.16.5-36.2.39.jar:36.2] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.minecraftforge.eventbus.EventBus.registerListener(EventBus.java:145) ~[eventbus-4.0.0.jar:?] {} -- MOD lmmmaid -- Details: Mod File: L4M-0.2.1.jar Failure message: LMMMaidMod (lmmmaid) has failed to load correctly java.lang.IllegalArgumentException: Method public static void com.LMMMaid.LMMMaidMod.reg.CommonEventBusSubscriber.onEntityInteract(net.minecraftforge.event.entity.player.PlayerInteractEvent$EntityInteract) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.lifecycle.IModBusEvent: class net.minecraftforge.event.entity.player.PlayerInteractEvent$EntityInteract Mod Version: 0.2.1 Mod Issue URL: NOT PROVIDED Exception message: java.lang.IllegalArgumentException: Method public static void com.LMMMaid.LMMMaidMod.reg.CommonEventBusSubscriber.onEntityInteract(net.minecraftforge.event.entity.player.PlayerInteractEvent$EntityInteract) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.lifecycle.IModBusEvent: class net.minecraftforge.event.entity.player.PlayerInteractEvent$EntityInteract Stacktrace: at net.minecraftforge.eventbus.EventBus.registerListener(EventBus.java:145) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.lambda$registerClass$2(EventBus.java:78) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus$$Lambda$3450/798062204.accept(Unknown Source) ~[?:?] {} at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:1.8.0_51] {} at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_51] {} at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_51] {} at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:1.8.0_51] {} at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) ~[?:1.8.0_51] {} at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) ~[?:1.8.0_51] {} at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_51] {} at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_51] {} at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_51] {} at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_51] {} at net.minecraftforge.eventbus.EventBus.registerClass(EventBus.java:78) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.register(EventBus.java:118) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.fml.AutomaticEventSubscriber.lambda$inject$6(AutomaticEventSubscriber.java:61) ~[?:?] {re:classloading} at net.minecraftforge.fml.AutomaticEventSubscriber$$Lambda$3407/360076723.accept(Unknown Source) ~[?:?] {} at java.util.ArrayList.forEach(ArrayList.java:1249) ~[?:1.8.0_51] {} at net.minecraftforge.fml.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:48) ~[?:?] {re:classloading} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:77) ~[?:36.2] {re:classloading} at net.minecraftforge.fml.javafmlmod.FMLModContainer$$Lambda$3302/1701331644.run(Unknown Source) ~[?:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[?:?] {re:classloading} at net.minecraftforge.fml.ModContainer$$Lambda$3352/1229526896.run(Unknown Source) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1618) ~[?:1.8.0_51] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1610) ~[?:1.8.0_51] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_51] {} at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_51] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689) ~[?:1.8.0_51] {re:computing_frames} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[?:1.8.0_51] {} -- System Details -- Details: Minecraft Version: 1.16.5 Minecraft Version ID: 1.16.5 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_51, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 6234512384 bytes (5945 MB) / 8589934592 bytes (8192 MB) up to 8589934592 bytes (8192 MB) CPUs: 16 JVM Flags: 13 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -XX:+IgnoreUnrecognizedVMOptions -Xms8G -Xmx8G -XX:MetaspaceSize=1G -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+DisableExplicitGC -XX:+OptimizeStringConcat -XX:+UseTLAB -Xss2G -Xmn2G ModLauncher: 8.1.3+8.1.3+main-8.1.x.c94d18ec ModLauncher launch target: fmlclient ModLauncher naming: srg ModLauncher services: /mixin-0.8.4.jar mixin PLUGINSERVICE /eventbus-4.0.0.jar eventbus PLUGINSERVICE /forge-1.16.5-36.2.39.jar object_holder_definalize PLUGINSERVICE /forge-1.16.5-36.2.39.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE /forge-1.16.5-36.2.39.jar capability_inject_definalize PLUGINSERVICE /forge-1.16.5-36.2.39.jar runtimedistcleaner PLUGINSERVICE /mixin-0.8.4.jar mixin TRANSFORMATIONSERVICE /forge-1.16.5-36.2.39.jar fml TRANSFORMATIONSERVICE FML: 36.2 Forge: net.minecraftforge:36.2.39 FML Language Providers: javafml@36.2 minecraft@1 Mod List: forge-1.16.5-36.2.39-client.jar |Minecraft |minecraft |1.16.5 |CREATE_REG|Manifest: NOSIGNATURE FarmersDelight-1.16.5-0.6.0.jar |Farmer's Delight |farmersdelight |1.16.5-0.6.0 |CREATE_REG|Manifest: NOSIGNATURE obfuscate-0.6.3-1.16.5.jar |Obfuscate |obfuscate |0.6.3 |CREATE_REG|Manifest: NOSIGNATURE blue_skies-1.16.5-1.1.3.jar |Blue Skies |blue_skies |1.1.3 |CREATE_REG|Manifest: NOSIGNATURE solpotato-1.16.X-1.1.0.jar |Spice of Life: Potato Edition |solpotato |1.16.X-1.1.0 |CREATE_REG|Manifest: NOSIGNATURE sophisticatedbackpacks-1.16.5-3.15.20.755.jar |Sophisticated Backpacks |sophisticatedbackpacks |1.16.5-3.15.20.755 |CREATE_REG|Manifest: NOSIGNATURE endrem-5.0.3-R-1.16.5.jar |End Remastered |endrem |5.0.3-R-1.16.5 |CREATE_REG|Manifest: NOSIGNATURE cfm-7.0.0pre22-1.16.3.jar |MrCrayfish's Furniture Mod |cfm |7.0.0-pre22 |CREATE_REG|Manifest: NOSIGNATURE dungeons_plus-1.16.5-1.1.5.jar |Dungeons Plus |dungeons_plus |1.1.5 |CREATE_REG|Manifest: NOSIGNATURE L4M-0.2.1.jar |LMMMaidMod |lmmmaid |0.2.1 |ERROR |Manifest: NOSIGNATURE jei-1.16.5-7.8.0.1009.jar |Just Enough Items |jei |7.8.0.1009 |CREATE_REG|Manifest: NOSIGNATURE SlashBlade-1.16-0.0.12.1.jar |Slash Blade |slashblade |0.0.12 |CREATE_REG|Manifest: NOSIGNATURE forge-1.16.5-36.2.39-universal.jar |Forge |forge |36.2.39 |CREATE_REG|Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90 tac-0.3.8.1-1.16.5.jar |Timeless and Classics Guns |tac |0.3.8.1 |CREATE_REG|Manifest: NOSIGNATURE strawgolem-1.16-1.9.jar |Straw Golem |strawgolem |1.16-1.9 |CREATE_REG|Manifest: NOSIGNATURE rubidium-mc1.16.5-0.2.13.jar |Rubidium |rubidium |0.2.13 |CREATE_REG|Manifest: NOSIGNATURE mostructures-forge-1.2.0-1.16.5.jar |Mo' Structures |mostructures |1.2.0-1.16.5 |CREATE_REG|Manifest: NOSIGNATURE invtweaks-1.16.4-1.0.1.jar |Inventory Tweaks Renewed |invtweaks |1.16.4-1.0.1 |CREATE_REG|Manifest: NOSIGNATURE curios-forge-1.16.5-4.0.8.1.jar |Curios API |curios |1.16.5-4.0.8.1 |CREATE_REG|Manifest: NOSIGNATURE oculus-mc1.16.5-1.4.6.jar |Oculus |oculus |1.4.6 |CREATE_REG|Manifest: NOSIGNATURE structure_gel-1.16.5-1.7.8.jar |Structure Gel API |structure_gel |1.7.8 |CREATE_REG|Manifest: NOSIGNATURE DungeonsArise-1.16.5-2.1.49-beta.jar |When Dungeons Arise |dungeons_arise |2.1.49 |CREATE_REG|Manifest: NOSIGNATURE Crash Report UUID: 1a38f958-ae0d-45fe-9309-96008707ed77 Loaded Shaderpack: Sildur's+Vibrant+Shaders+v1.51+Extreme-VL.zip Profile: Custom (+0 options changed by user) Since this is my first time creating a mod, the code might be a bit rough. I appreciate your help in advance. Have a great day