Jump to content

[Solved] [1.12.2] Reflection fails to find method


Recommended Posts

Posted (edited)

I am using reflection to get the EntityLiving#getLootTable (SRG name: "func_184647_J") method of an EntityLiving. However, this sometimes (rather rare) fails to work with modded mobs, which, although inherits from the EntityLiving class, does not seems to have the method with SRG name "func_184647_J".

 

The crash report below is an example of EntityGaiaMinotaur from Grimoire of Gaia, which, according to the source code, does inherit from EntityLiving, but does not have the method "func_184647_J".

Note that the EntityLiving#getLootTable (SRG name: "func_184647_J") fetching works with most modded mobs, but not with some specific ones.

---- Minecraft Crash Report ----
// Ooh. Shiny.

Time: 2019-02-23 08:02:36 EST
Description: Error executing task

java.util.concurrent.ExecutionException: net.minecraftforge.fml.relauncher.ReflectionHelper$UnableToFindMethodException: java.lang.NoSuchMethodException: gaia.entity.monster.EntityGaiaMinotaur.func_184647_J()
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at net.minecraft.util.Util.runTask(SourceFile:531)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:723)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:185)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
    at java.lang.Thread.run(Unknown Source)
Caused by: net.minecraftforge.fml.relauncher.ReflectionHelper$UnableToFindMethodException: java.lang.NoSuchMethodException: gaia.entity.monster.EntityGaiaMinotaur.func_184647_J()
    at net.minecraftforge.fml.relauncher.ReflectionHelper.findMethod(ReflectionHelper.java:303)
    at cn.davidma.tinymobfarm.util.LootTableHelper.getLootTableLocation(LootTableHelper.java:27)
    at cn.davidma.tinymobfarm.item.Lasso.interactEntity(Lasso.java:66)
    at cn.davidma.tinymobfarm.item.template.InteractiveMobTool.itemInteractionForEntity(InteractiveMobTool.java:61)
    at net.minecraft.item.ItemStack.interactWithEntity(ItemStack.java:391)
    at net.minecraft.entity.player.EntityPlayer.interactOn(EntityPlayer.java:1220)
    at com.tmtravlr.potioncore.network.PacketHandlerServer.useEntity(PacketHandlerServer.java:96)
    at com.tmtravlr.potioncore.network.PacketHandlerServer.lambda$onMessage$1(PacketHandlerServer.java:66)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at net.minecraft.util.Util.runTask(SourceFile:529)
    ... 5 more
Caused by: java.lang.NoSuchMethodException: gaia.entity.monster.EntityGaiaMinotaur.func_184647_J()
    at java.lang.Class.getDeclaredMethod(Unknown Source)
    at net.minecraftforge.fml.relauncher.ReflectionHelper.findMethod(ReflectionHelper.java:297)
    ... 15 more

 

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted

Try stepping through your code with the debugger

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
  On 2/27/2019 at 8:23 AM, diesieben07 said:

Most likely you did not fix the 2nd issue I pointed out.

Expand  

That seems to be the problem. I forgot to change it in my 1.12.2 branch. Thanks.

Some tips:

  Reveal hidden contents

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.