Hi, I have an issue using some obfuscated code (ne...
# announcements
w
Hi, I have an issue using some obfuscated code (net.minecraft.server): I'm trying to call this functions
DataWatcherRegistry.b.a(7)
but there is a conflict because there are two functions named
a
. One returns
DataWatcherObject<T>
(the one I want) and another returns
T
. How can I select the correct one, because right now, I'm getting some conflicts.
a
tell the kotlin compiler what the return type should be
w
That does not work. This is the function I'm trying to call:
Copy code
public static final DataWatcherSerializer<Integer> b = new DataWatcherSerializer<Integer>() {
        public void a(PacketDataSerializer var1, Integer var2) {
            var1.d(var2);
        }

        public Integer b(PacketDataSerializer var1) {
            return var1.g();
        }

        public DataWatcherObject<Integer> a(int var1) {
            return new DataWatcherObject(var1, this);
        }

        public Integer a(Integer var1) {
            return var1;
        }
    };
Or the object for the function I'm trying to call 😛
a
how are you trying to call it?
w
val dataWatcherObject: DataWatcherObject<Int> = DataWatcherRegistry.b.a(7) as DataWatcherObject<Int>
a
remove the
as ....
w
That does not work
a
what is the error message?
w
I think the problem lies in Kotlin not having primitives. The error message is:
Copy code
ItemframeNPC.kt:[53,87] Overload resolution ambiguity:
[ERROR] public abstract fun a(p0: Int): DataWatcherObject<Int!>! defined in net.minecraft.server.v1_12_R1.DataWatcherSerializer
[ERROR] public abstract fun a(p0: Int!): Int! defined in net.minecraft.server.v1_12_R1.DataWatcherSerializer
a
yes, it kinda has to do with it, because
int
is the same as
Int
in kotlin, so if you try to write
DataWatcherObjectSerializer<T>
in kotlin it won't allow you, because of conflicting overloads
w
Is it possible to force the use of int instead of Int?
a
IIRC there is no way to tell kotlin to use
int
instead of
Integer
w
Hmm
Then how could I use this???
k
Create a thin Java wrapper around it.
1
I wonder why they keep obvuscating Minecraft, 99% of it has been deobvuscated anyway.