kangarko / Foundation

Foundation™ helps you create highly customized Minecraft plugins (based on Spigot/Paper API) that support multiple MC versions.

Home Page:https://mineacademy.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reflection Exception Foundation 6.3.2, Paper 1.19.4

SimonSaltys opened this issue · comments

Running Paper 1.19.4-R0.1-SNAPSHOT and Java 18.0.2.1

Encountering a ReflectionException when clicking in a Menu.
Full error log attached below.
error.log

Hello

Just trying to help kangarko here so it seems it's looking for j in the class Integer, this while it should be looking in the class Container this seems to be caused by this check https://github.com/kangarko/Foundation/blob/master/src/main/java/org/mineacademy/fo/remain/Remain.java#L1628 getting the bU (Integer) value instead of the proper bP (Container) field.

I'll edit this message if I'm able to figure out why that check fails but if I don't you already know where to start looking.

I think the main cause is in this part of the line version.contains("R3") ? "bP" : "bU"

All the best
Nick

Hello

Just trying to help kangarko here so it seems it's looking for j in the class Integer, this while it should be looking in the class Container this seems to be caused by this check https://github.com/kangarko/Foundation/blob/master/src/main/java/org/mineacademy/fo/remain/Remain.java#L1628 getting the bU (Integer) value instead of the proper bP (Container) field.

I'll edit this message if I'm able to figure out why that check fails but if I don't you already know where to start looking.

All the best Nick

J is the windowsid and should be in player class (the mincraft, not bukkit player class, i think you find it). Yeah I think i find it though the player class, my own quote to find "j" inside net.minecraft.world.inventory class Container do you have this field newer version is it j

If I look on this message org.mineacademy.fo.ReflectionUtil$ReflectionException: No such field j in Integer or its superclasses it can't find the "j" field so that are change in 1.19.4.

We first get the 'activeContainer' (Container) from the player (EntityPlayer) which is stored in bP in 1.19.4 and bU in other 1.19 versions. Then we get the 'windowsid' from the Container which is stored in j. Issue is that it still got bU for 1.19.4 getting the incorrect value an Integer instead of the Container we actually need to get the 'windowsid' from.

I've worked with NMS before and traced the steps in both versions I think it's a little confusing since some may think the 'windowsid' is directly stored in the player (EntityPlayer) class while it's actually inside the Container field which is stored inside the player (EntityPlayer) class.

Hope that helped clearing things up as NMS can be tricky sometimes.

All the best
Nick

We first get the 'activeContainer' (Container) from the player (EntityPlayer) which is stored in bP in 1.19.4 and bU in other 1.19 versions. Then we get the 'windowsid' from the Container which is stored in j. Issue is that it still got bU for 1.19.4 getting the incorrect value an Integer instead of the Container class we actually need to get the 'windowsid' from.

I've worked with NMS before and traced the steps in both versions I think it's a little confusing since some may think the 'windowsid' is directly stored in the player (EntityPlayer) class while it's actually inside the Container field which is stored inside the player (EntityPlayer) class.

Hope that helped clearing things up as NMS can be tricky sometimes.

All the best Nick

Yeah was not yesterday I work with this :) It is way I keep the nots to were you find all fields and methods :) and windowId change every time player open the inventory (so seams to be only a temporary value).

Yeah the problem seams to be something else, When look in the 1.19.4 nms it is still "j", was the error message some confuse me. and the container filed is "bP"

((EntityPlayer)entityhuman).b.a(new PacketPlayOutSetSlot(this.j, this.k(), slot.e, slot.e()));

I'm not going to claim that I'm an expert at this and was just trying to help here the error just to me explained that it's looking in the incorrect class as it mentioned Integer as original class name (as in the class it's looking up the value in) which doesn't make a lot of sense anyways I could be wrong and I'm sure kangarko will be able to resolve it.

All the best
Nick

I'm not going to claim that I'm an expert at this and was just trying to help here the error just to me explained that it's looking in the incorrect class as it mentioned Integer as original class name (as in the class it's looking up the value in) which doesn't make a lot of sense anyways I could be wrong and I'm sure kangarko will be able to resolve it.

All the best Nick

Yeah I think is what happened. I think it is why the "j" error get trigged. I self made my own class for menu tittle update, So I have pretty good knowledge about were to find it and troubleshot.

So I think "R3" not exist for 1.19.4 or spigot/bukkit missed to add that part. I can test this out later on, when I have time :)

commented

Thanks, should already be patched but the version is not yet out, going to release it by tonight :)