#[IN DEV] CVN (Cross-Version-NMS)

1 messages · Page 1 of 1 (latest)

fallow sky
#

Okay, so let's create a lib TOGETHER (URSS anthem please) to interact with multiple Minecraft versions' nms using an intermediary approach (something like fabric intermediary)

WE should make a maven/gradle plugin to transform from remapped to intermediary, and a lib with a classloader that will be able to convert intermediary to obfuscated on runtime. Then remap the plugins so intermediary is remapped into obfuscated in the plugin classes and then load them to the spigot server like usual

Github : https://github.com/SpigotCVN

#
#

Feel free to help with some code you made/you found !

winter turret
#

You just want to make multi versions compatibility ?

winter turret
#

there is a readable exemple

#
 private SlimeNMS getNMSBridge() throws InvalidVersionException {
        String version = Bukkit.getServer().getClass().getPackage().getName();
        String nmsVersion = version.substring(version.lastIndexOf('.') + 1);

        switch (nmsVersion) {
            case "v1_8_R3":
                return new v1_8_R3SlimeNMS();
            case "v1_9_R1":
                return new v1_9_R1SlimeNMS();
            case "v1_9_R2":
                return new v1_9_R2SlimeNMS();
            case "v1_10_R1":
                return new v1_10_R1SlimeNMS();
            case "v1_11_R1":
                return new v1_11_R1SlimeNMS();
            case "v1_12_R1":
                return new v1_12_R1SlimeNMS();
            case "v1_13_R1":
                return new v1_13_R1SlimeNMS();
            case "v1_13_R2":
                return new v1_13_R2SlimeNMS();
            case "v1_14_R1":
                return new v1_14_R1SlimeNMS();
            case "v1_15_R1":
                return new v1_15_R1SlimeNMS();
            default:
                throw new InvalidVersionException(nmsVersion);
        }
    }
fallow sky
#

yeah I see

#

something like that, but much more global, you'll see ;)

winter turret
#

ok ok 🙂

fallow sky
winter turret
#

the aime is to be used by several plugins as api ?

winter turret
#

Oh i see this should be very interesting

fallow sky
winter turret
#

yeah currently it's a wast of time to implement each nms versions 😦

fallow sky
rigid saffron
winter turret
#

Yes I miss understand the question of PauLem

rigid saffron
#

I had the idea of such a thing longer ago so I was happy to see somebody have a similar idea

winter turret
#

Wow you are both French ? 😄

rigid saffron
#

Am german

fallow sky
winter turret
#

The "Mayo/naise" caught me xD

fallow sky
#

oh lol x)

rigid saffron
winter turret
#

It's better than the Ketchup

rigid saffron
#

Well, this is getting a bit off topic

fallow sky
#

I think too x)

winter turret
#

a bit

fallow sky
#

but np with that

winter turret
#

(sorry)

rigid saffron
#

Well, I do have more of an idea on how to do this now

fallow sky
rigid saffron
#

Okay, so
We need to create our own intermediary mappings using some software linked on this repo, we will start at 1.8 and update the mappings for all spigot versions

Then we need some classloader that the plugins utilizing the library will use. That classloader will have the mappings for the current spigot version (it'll either have them all hardcoded or it will dynamically download them from some github repo) and will find nms classes by their intermediary names. So, when there is a call to load net.minecraft.server.c_1509_ it will load net.minecraft.server.v1_17_R1.b or whatever the obfuscated name is

The last, but not least part is the maven/gradle plugin. That will find the intermediary name and change it to that (for example, change net.minecraft.server.v1_17_R1.Player to net.minecraft.server.c_1509_ or something like that)

This is just a rough idea on how that would work, I have no idea how to implement that and whether this is exactly how it works

fallow sky
#

I'm not a native english, so still a bit lazy with english, but I think I'll understand when I'll deal more with nms

#

I'll see how to implement after making the first logic working

#

(and it'll be soon on github)

winter turret
#

But what the aim this nms api exactly ? I mean what are the limits ? If this API give an abstract access to all nms classes it's literaly a project like Bukkit or Fabric right ? Or I just still don't understand

fallow sky
winter turret
#

but wich interactions ?

fallow sky
winter turret
#

All nms versions are differents we can't have the same abstract access for all versions

winter turret
#

how to manage that ? If we must check manually might as well use NMS

fallow sky
#

okay

#

so let's use modules

rigid saffron
# winter turret All nms versions are differents we can't have the same abstract access for all v...

Well, a lot of common code is kept accross versions (mojang doesn't rewrite minecraft every few months) and something like this will majorly optimize usage of common code. Imagine this:
You have nms implementations from 1.8 to 1.20, but the only versions where the nms code actually changed were 1.13 and 1.17
With this lib you could drastically reduce the amount of code needed in a mostly efficient way

winter turret
#

Ok i think I see, with this example we write only two implémentation (pre 1.13 and 1.13+) instead to implement all nms vesrion between 1.8 and 1.20 ?

fallow sky
#

but first, I need to know the "commons codes" between each version, so let's do it with modules first

#

the only problem I'll see with reflection is that each method has a different name between each version of minecraft because of obfuscation (b(), e())

#

so it would need me to search the name of the method in this version, based on the mapping, which have a common name between each version

rigid saffron
#

I think you are still misunderstanding the concept I suggested

fallow sky
rigid saffron
fallow sky
rigid saffron
#

what exactly did you start

fallow sky
rigid saffron
#

Show code

fallow sky
#

actually in very beta

#

but working

rigid saffron
#

You are just implementing nms classes as your own right?

fallow sky
#

but I'll group that

rigid saffron
#

That's the approach we do not want, as that requires lots of working and that's basically just rewriting bukkit inside of bukkit but extra complicated

fallow sky
#

I'll use reflection after, but first I need to understand correctly nms

rigid saffron
#

The idea of intermediary mapping nms is to allow directly interacting with nms without any wrapping

fallow sky
#

I know

#

but please, wait a bit

rigid saffron
#

Ok

fallow sky
#

I said three times that I first need to understand nms correctly

rigid saffron
#

Technically, this project doesn't really require knowledge of nms

fallow sky
#

but

#

for 1.13 and before, there isn't any intermediary mapping

rigid saffron
#

We can generate it ourselves

fallow sky
rigid saffron
#

Yeah

fallow sky
# rigid saffron Yeah

but how can I then get the mappings for a specific version in my code and then get the corresponding obfuscated name?

rigid saffron
#

Upload the mappins somewhere (for example github) and dynamically download them depending on the version, using a classloader and a fuckton of magic we find and remap the classes we need and give it to the plugins

rigid saffron
#

I guess we'll even need asm or something like that to remap the classes properly

fallow sky
#

I never used asm

#

but anyway, that's a collective project

rigid saffron
fallow sky
rigid saffron
fallow sky
#

much more understandable x)

#

thank you

#

doesn't seem that difficult

rigid saffron
#

Yeah, just load the correct class and remap all fields and methods

#

The biggest issue is remapping fields and methods, that sounds like modifying class bytecode

fallow sky
#

yeah

#

do you know how to generate mappings using matcher? I'm stuck

#

`java.lang.UnsupportedClassVersionError: org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0`

#

Changing the default project java does nothing

rigid saffron
#

Can you change the JAVA_HOME

fallow sky
fallow sky
#

I'm just downloading java 11, seems to be the used version

#

humm, my very good network connexion

#

oh, that's the outdated fork

#

@rigid saffron huh

#

what should I do there?

rigid saffron
#

¯_(ツ)_/¯

fallow sky
#

oh, I found a doc

rigid saffron
#

never used it before, on the top there is "File", "Matching", "Mapping", etc

fallow sky
#
GitHub

legacy intermediaries 1.13 - 1.0.0. Contribute to Legacy-Fabric/Legacy-Intermediaries development by creating an account on GitHub.

GitHub

Minecraft mappings for legacy versions, from indev-20091223-2 to 1.14.4 - OrnitheMC/feather-mappings

fallow sky
#

@rigid saffron I must switch to gradle to use intermediary mappings ?

inland spoke
#

depends on what you define as must

fallow sky
inland spoke
#

what I'm saying is if there is a will there is a way

fallow sky
inland spoke
fallow sky
rigid saffron
#

you would wanna write some plugin that will remap the plugin after compiling

#

you could make it a maven plugin too

fallow sky
#

oh yeah I see

inland spoke
#

But I know that writing maven extensions (not plugins - unless you want to copy the curse that is the specialsource plugin) might be a valid way of achieving that

fallow sky
rigid saffron
#

shits complicated

woven arrow
#

why even use maven in the first place, imo gradle is way better

rigid saffron
#

but I talked about writing a gradle/maven plugin from the beggining

inland spoke
#

however for all intents and purposes sticking with gradle is the more sensical approach unless one has already experience with writing maven plugins

fallow sky
woven arrow
inland spoke
#

Also easily possible using gradle, FYI.
Some might say it is even easier compared to maven

woven arrow
#

yea

fallow sky
#

I also use maven much more than gradle

woven arrow
#

okay but you can still use gradle

rigid saffron
#

I always use gradle

fallow sky
#

but I should switch to gradle

woven arrow
#
  • you get the added benefit of kotlin script :DDD
rigid saffron
woven arrow
#

better than groovy

inland spoke
#

I don't see the benefit of kotlin script

fallow sky
#

I don't see kotlin script

woven arrow
#

xml-based configs are a pain

rigid saffron
woven arrow
#

you, sir, are a menace

fallow sky
#

guys

rigid saffron
fallow sky
#

you should copy the repo and do some pull requests to make the work faster !

#

OUR WORK

inland spoke
#

It's meant to be a script - not an entire programming language. Ditching eclipse over a few changes in syntax is not worth it imo.
if you want to have complicated logic, you have a gradle plugin written in java

fallow sky
#

even the base structure

woven arrow
#

isn't it meant to be your project

fallow sky
#

OUR project

woven arrow
#

communism, i see

rigid saffron
woven arrow
#

i knew it

inland spoke
woven arrow
#

lmao

woven arrow
#

all the kotlin haters arising rn

rigid saffron
woven arrow
#

ohhh

inland spoke
fallow sky
woven arrow
#

it's a proper language 🤷

#

compared to.. whatever groovy is

#

groovy is a kink

rigid saffron
#

sometimes I wish we had less of those "proper languages"

inland spoke
#

Well groovy is a nice programming language for configurations

woven arrow
#

how-

fallow sky
woven arrow
#

no.

inland spoke
#

Using groovy for anything other than assignments (be it through closures or whatever) is a bit iffy

rigid saffron
inland spoke
#

If you have a standard for loop in your buildscript, you are doing something you should not be doing

fallow sky
inland spoke
#

FFI cries in the corner

woven arrow
fallow sky
#

so, let's re-talk about GNI, WE should make a maven/gradle plugin to transform from remapped to intermediary, and a lib with a classloader that will be able to convert intermediary to obfuscated on runtime. Then remap the plugins so intermediary is remapped into obfuscated in the plugin classes and then load them to the spigot server like usual

rigid saffron
#

then a classloader that will be able to convert intermediary to obfuscated on runtime

rigid saffron
#

yeah

rigid saffron
#

and that class loader will also perform some funky binary operations modifying the classes method and field names to allow calling from intermediary and a lot of other shit that my brain is barely able to comprehend

fallow sky
#

I add that to the paragraph

rigid saffron
woven arrow
#

doesn't paper remap plugins

#

you could check what they do ig

woven arrow
rigid saffron
#

totally forgot

fallow sky
#

WE would be able to remake fabric server-side api when GNI will be finished, right?

woven arrow
#

why fabric

fallow sky
woven arrow
#

but it is?

rigid saffron
woven arrow
#

how else would you use their api

fallow sky
#

it is ?

rigid saffron
woven arrow
#

ofc it is lmao

fallow sky
#

forget what I said

#

I'm a bit lazy with forge modding lol

woven arrow
#

why mods tho

fallow sky
woven arrow
#

yea

rigid saffron
rigid saffron
#

my brain is a bit fried, excuse me please

fallow sky
#

x)

#

client in spigot, what a good news

woven arrow
#

i don't get why you need a mod here

rigid saffron
#

we need no mods

fallow sky
woven arrow
#

that's what i'm saying lol

fallow sky
#

we need what makes mod able to write code without class.b and class.e(var1, var2 OH WHAT THE HELL IS THIS)

rigid saffron
fallow sky
#

but with a good and convenient Crepper.makeHimExplodes(rightnow) 🤗

fallow sky
woven arrow
#

@rigid saffron if i ever contribute to this you know damn well i'll only write kotlin

fallow sky
#

and also, we use fabric because fabric has a lot of code like this

rigid saffron
rigid saffron
fallow sky
woven arrow
#

you will have a thousand statics tho as jetbrains converts companion objects to statics (if you use their button to convert kotlin -> java)

fallow sky
rigid saffron
woven arrow
#

oh god

fallow sky
rigid saffron
#

ain't gonna let some automation replace my job (my job is to create automation)

fallow sky
fallow sky
#

(not me, the original message 🤓)

fallow sky
#

I've got so many questions because I don't know how to use this/ASM

rigid saffron
fallow sky
#

hmm

rigid saffron
#

also, because of how spigot works, we might want to load the plugins that depend on the lib ourselves and then throw them into spigot, this way we don't experience problems with spigot fucking shit up

rigid saffron
#

We can also just make them use a file different than plugin.yml

#

Idk, gniplugin.yml

fallow sky
#

yeah, though of that too

woven arrow
#

bro is making a spigot fork

rigid saffron
#

Nah, just a lib

#

A plugin that will load more plugins

woven arrow
#

so a plugin loader

rigid saffron
#

Yeah

woven arrow
#

doesn't paper have custom plugin loaders now

fallow sky
#

wouldn't it be easier to transform everything at compile?

rigid saffron
rigid saffron
#

And I would probably quit this if we make it paper dependent

woven arrow
#

LOL

fallow sky
#

no paper dependent

#

we are here for SPIGOT

#

even bukkit if possible

#

but who uses bukkit without spigot?

rigid saffron
#

Imagine using "craftbukkit"

fallow sky
#

👀

rigid saffron
#

Dunno about the "craft" part, but yeah

fallow sky
rigid saffron
#

This is yet another project that is split into the runtime part and the dev tools part lol

#

Additional to this project we could also maybe write a plugin that will fuck around with the ide and stuff to remap the game into all mappings the user would like to (mojmaps, parchment, spigot for older versions, unmapped/obfuscated, mcp for older versions, yarn)

#

@fallow sky updated that one thing I drew before to match the current idea

fallow sky
#

oh okay I'll see that

rigid saffron
#

Or maybe this is better

rigid saffron
#

I decided to try to write a remapping plugin and I have already cloned 2 repos

fallow sky
#

"Intermediary would work for this use case. You can use tiny remapper to do the actual remapping of the classes.
There isn't really a guide for this kind of thing. The easy way to do it would be to do it in 2 stages. First remap the plugin to intermediary (using intermediary data for the source version). And then remap from intermediary to the official names (using intermediary for the target version)
You could use mapping-io to create a single set of mappings to do it in one pass.

My first suggestion you could likely do without any code. You can just use the tiny remapper command line.
I'd get it working first, and then get clever with mapping-io later."

To download intermediary mappings -> "You can download those from the intermediary maven or GitHub."

#

(just for pinning)

fallow sky
#

let's go sleep, gn

rigid saffron
#

I went through the code of the lib and also experimented with it a bit, it takes in the tiny mappings and then you can get the remapped name if you have the original or vice versa

#

The namespace for the original (obfuscated) mapping is called original and the one for intermediary is called intermediary

rigid saffron
inland spoke
rigid saffron
#

oh wow, the longer I look at this the more hell it gets

#

I guess I'll have to original map it first, then intermediary map it

inland spoke
#

how so?

rigid saffron
#

and then I'll also wanna write all of that in both, a gradle and maven plugin

#

and I have no idea how any of those work

inland spoke
#

I mean yeah, you have to reverse the mappings but that isn't witchcraft

#

Also, writing gradle plugins isn't that bad as in the worst case you can plainly bruteforce the remapping process

rigid saffron
#

but sounds cool

#

where does spigot have its mapping files

#

or does it directly pull mojang mappings

inland spoke
#

I used to bruteforce the remapping process by plainly calling TR repeatedly in a plugin of mine as performance wise it was okay

inland spoke
#

mapping format; most likely a derivative of SRG

rigid saffron
#

mojmaps btw

inland spoke
#

If it is mojmap, read the license

#

Otherwise, read the license

rigid saffron
#

ehh, nobody ain't gonna sue me anyways, right?

inland spoke
#

Compared to tinyv1 srg is one of the worst mapping formats on earth, but unfortunately srg is very frequently used

rigid saffron
#
# (c) 2020 Microsoft Corporation. These mappings are provided "as-is" and you bear the risk of using them. You may copy and use the mappings for development purposes, but you may not redistribute the mappings complete and unmodified. Microsoft makes no warranties, express or implied, with respect to the mappings provided here.  Use and modification of this document or the source code (in any form) of Minecraft: Java Edition is governed by the Minecraft End User License Agreement available at https://account.mojang.com/documents/minecraft_eula.```
#

lol

inland spoke
#

it might even be the worst mapping format due to how flawed it is

rigid saffron
inland spoke
#

oh you know, being not verbose enough?

rigid saffron
#

and that means?

inland spoke
#

Well it's missing the descriptor. So while you might know that something needs to be remapped, you don't actually know what that something is

rigid saffron
#

btw, the mojmaps I sent are from intermediary to mojang iirc

inland spoke
#

also, there might be more than just one intermediary format FYI

rigid saffron
#

I know too much about intermediary mappings already, don't worry

#

hmm, I just tried manually remapping and it seems that minecraft classes in spigot are in a different place than in the mappings ._.

#

what a fucking pain in the ass

#

or no?

#

idk

#

why did it not remap

inland spoke
#

you'll probably be better off using the same inputs as the specialsource plugin tbh

#

or you could use paper and use the inputs provided by paperweight

rigid saffron
#

mf why did you not remap anything

inland spoke
#

did you forget to attach the minecraft jar to the remapping library classpath

rigid saffron
#

the what and the what

spiral onyx
#

no idea what yall doing but looks fun ill join the thread

rigid saffron
#

it's painful

spiral onyx
#

i did and i don't understand shit

#

deal with it yourself

#

lol

rigid saffron
#

basically, we are making a library and a gradle/maven plugin, the plugin remaps the plugin to intermediary mappings after compilation and the library remaps the plugin to the current obfuscated mappings and then loads it as a normal spigot plugin

spiral onyx
#

no i understand that

#

i just don't want to understand the internals

#

i'm busy

rigid saffron
spiral onyx
#

lol

fallow sky
#

I'll make the part for downloading the good intermediary mappings for the current server version from GitHub @rigid saffron

#

Let's split the work, as I can see you already have something pretty good 👍

rigid saffron
#

ye

#

LET'S GOOOO IT REMAPPED

#

this is surely gonna be a pain in the ass

#

Btw MinecraftServer#method_3864(boolean) aka MinecraftServer#d(boolean) is MinecraftServer#setUsesAuthentication(boolean) in mojmaps, so that plugin literally just disables online mode forever lol

spiral onyx
#

Fuck them pirated servers

#

(well except for local testing because i only have 2 accounts)

rigid saffron
#

I remember I had a few cracked friends so I made a fabric mod so they can join my lan world

fallow sky
fallow sky
#

I was about to suggest from intermediary to mojmaps, but some mojmaps names change between versions?

fallow sky
#

so we shouldn't do that?

rigid saffron
#

We should not, yes

fallow sky
#

okay okay

rigid saffron
# fallow sky PERFECT

I did have to write the code in obfuscated nms because gradle fuckery, but who cares

rigid saffron
#

Basically, I now know everything I need to know

fallow sky
#

perfect

rigid saffron
#

The only problem I have on my mind rn is: will we have the user manually tell us the mc version they are using or can we somehow automate that

fallow sky
#

I'm starting the mapping downloader, shouldn't take long

rigid saffron
#

We can get the spigot artifact I think

#

But I'm unsure

fallow sky
#

with this

#

there is the perfect method inside to get the mc version, this is not a problem

#

and if the user encouter a bug, we can make a simple config file to override the detected minecraft version

#

but this shouldn't happen

#

this is how we get the minecraft version:```java
/**

  • Returns the actual running Minecraft version, e.g. 1.20 or 1.16.5
  • @return Minecraft version
    */
    private String getMinecraftVersion() {
    if (minecraftVersion != null) {
    return minecraftVersion;
    } else {
    String bukkitGetVersionOutput = Bukkit.getVersion();
    Matcher matcher = Pattern.compile("\(MC: (?<version>\d+\.\d+(\.\d+)?)\)").matcher(bukkitGetVersionOutput);
    if (matcher.find()) {
    return minecraftVersion = matcher.group("version");
    } else {
    throw new RuntimeException("Could not determine Minecraft version from Bukkit.getVersion(): " + bukkitGetVersionOutput);
    }
    }
    }```
#

@rigid saffron, thanks to mfnalex basically x)

rigid saffron
#

Not the issue I was talking about

fallow sky
rigid saffron
#

When compiling, we need to know the minecraft version

#

Not on runtime

fallow sky
#

oh yeah

rigid saffron
#

Because of mappings, yk

fallow sky
#

can't we compile the plugins directly at runtime?

rigid saffron
#

What the fuck are you saying

fallow sky
#

hmmm

rigid saffron
#

Do you want to make users install fricking java code or what

#

Actually, I think we can get the spigot artifact, the version and even the location on the local maven repo

fallow sky
fallow sky
rigid saffron
#

No

#

Gni remapper gets version, remaps to intermediary

fallow sky
#

oh okay

rigid saffron
#

Our only issue would be paper and its mojmapping stuff

fallow sky
#

huh, paper 🤮 (for dev)

rigid saffron
#

Most servers run on paper, not like we have a choice

rigid saffron
#

We could likely detect versions above 1.20.6 and then remap plugins into the current mojmaps

#

Intermediary will let us remap plugins to anything at runtime

rigid saffron
#

In paper, I mean

fallow sky
#

oh okay

#

so only remapping to mojmaps after 1.20.5

rigid saffron
#

Ye

fallow sky
rigid saffron
#

I think paper should even have some methods for doing that, since it does that itself

rigid saffron
fallow sky
inland spoke
#

runtime mojmaps are a standard these days

#

the only notable modloader of note that does not do that is fabric

rigid saffron
#

They can do it because they never directly ship mojmaps, they remap on runtime

rigid saffron
inland spoke
#

there is 0 sense in using intermediary mappings since you will use mojmap anyways for stacktraces

fallow sky
#

but, using mojmaps instead of obfuscate for some cases isn't a problem, right ?

inland spoke
#

intermediary only makes sense for older versions where mojmap plainly never existed

fallow sky
rigid saffron
fallow sky
#

the goal : 1.8-latest

#

huh

#

good luck for those developing before 1.14 lol, no docs because it wasn't build officially before 1.14

inland spoke
#

Thing is - all these versions have already been released

fallow sky
inland spoke
#

You can easily just skip the intermediary process and go straight from named -> official

rigid saffron
fallow sky
#

okay, let's make the downloader

rigid saffron
inland spoke
#

on gradle you are probably better off using configurations imo

fallow sky
rigid saffron
#

You should've made an org for gni

fallow sky
#

yeah, I thought of that

#

let's do that

#

I never made an org x)

rigid saffron
#

I have one time

fallow sky
#

@rigid saffron I name it GNI ?

rigid saffron
#

Yeah

fallow sky
#

@inland spoke wanna be in this org too?

inland spoke
#

I suppose that is possible

fallow sky
inland spoke
#

well I mean 3-latter org names are probably all taken already

rigid saffron
fallow sky
#

SpigotGNI

#

contact email...

inland spoke
#

Unified-NMS-Interface would be more to the point imo

rigid saffron
#

UNI

#

UNMSI

rigid saffron
fallow sky
#

so

#

which abreviation?

rigid saffron
fallow sky
#

choose x)

rigid saffron
#

What about we spin da wheel?

fallow sky
#

pretty good 👍

#

let's ||not|| choose that

#

we'll see later

#

Cross-Version-NMS for now x)

rigid saffron
#

Okay

#

Can you even change org names

fallow sky
#

idk

#

@rigid saffron which one?

rigid saffron
#

Essig

fallow sky
#

ok

rigid saffron
#

The one before is the one I lost access to

fallow sky
#

@inland spoke I invited you

#

[IN DEV] CVN (Cross-Version-NMS)

inland spoke
#

ok

fallow sky
#

perfect

rigid saffron
#

Ideal pfp fr fr

fallow sky
#

hmm

#

I think we can do better x)

rigid saffron
#

Lol

fallow sky
#

let me cook

rigid saffron
#

This should be better fr fr

fallow sky
#

OUR PROJECT

rigid saffron
#

LMFAO

fallow sky
rigid saffron
#

Why is that message not pinned

fallow sky
#

I can't pin

rigid saffron
#

We need somebody to pin it

fallow sky
#

should I ping a mod? x)

rigid saffron
#

¯_(ツ)_/¯

fallow sky
#

let's wait

rigid saffron
#

Thank you great conclube

fallow sky
little pier
rigid saffron
#

hmm I wonder how the specialsource maven plugin or whatever it was called reobfuscates stuff

#

and of them all, spigot uses the most fucked one, csrg

#

hmm, the mojmaps spigot stores is of the ProGuard format (likely what it is originally download as)

#

painful

rigid saffron
woven arrow
fallow sky
#

hmm

woven arrow
#

everything spigot is open source lol

fallow sky
#

perfect

rigid saffron
#

Specialsource

spiral onyx
#

Specialsource

fallow sky
#

waw

#

gradle is much better than maven

rigid saffron
fallow sky
rigid saffron
#

the imports I ended up using

#

I wonder if I can rewrite it to only use SpecialSource

rigid saffron
fallow sky
#

hmmm

fallow sky
#

never digged into the creation of plugins with gradle

#

I'm working on the mappingsdownloader

#

really easy

fallow sky
#

hm

rigid saffron
#

yeah

fallow sky
#

to have full control on mappings if there is any problem

rigid saffron
#

damn I think it's working

#

I'm unsure

#

give me a few mins

fallow sky
#

okay

woven arrow
spiral onyx
rigid saffron
#
  1. originally compiled jar
  2. reobfuscated jar
  3. intermediary mapped jar
    FUCK YEAAAH
spiral onyx
#

if you use too many imports of the same package it condenses them

woven arrow
#

there's an option to disable it

spiral onyx
#

i mean

spiral onyx
#

i do see why

#

potential conflicts with other classes of the same name in different packages

#

but that happens so rarely

#

that it basically never happens

rigid saffron
#

we gotta celebrate this

fallow sky
#

x)

#

let's test the mappings downloader

#

I almost finished him

rigid saffron
#

it pulled the intermediary mappings from the mappings repo and the spigot jar and mojmaps from the maven local repo (spigot puts the things there)

fallow sky
#

will be our notation

rigid saffron
#

so if you ran buildtools once it will work

fallow sky
#

perfect

rigid saffron
#

this is amazing

#

I love this so much

fallow sky
#

x)

#

you can be proud of you 🫡

woven arrow
rigid saffron
#

only the methods, I need to test the gradle part

fallow sky
#

that's clean

woven arrow
#

that is pretty cool yeah

rigid saffron
#

thank god I didn't need to write the asm myself

woven arrow
#

thank md

rigid saffron
#

and the fabric guys

fallow sky
#

x)

rigid saffron
#

that will also be licensed under LGPL because of the fabric guys lol

fallow sky
#

thanks fabric

rigid saffron
fallow sky
#

wat

#

huh

#

R0.1

#

if I remember correctly, there is a version with a R0.2

#

or smth like that

rigid saffron
#

¯_(ツ)_/¯

#

probaly

spiral onyx
#

lol

fallow sky
#

hmm

rigid saffron
#

but I have not encountered one yet, so no

fallow sky
#

not in my repo

rigid saffron
spiral onyx
spiral onyx
# rigid saffron

ah, my favorite spigot version. 1.19.4-R0.1-SNAPSHOT-R0.1-SNAPSHOT

rigid saffron
rigid saffron
fallow sky
spiral onyx
#

devmgmt.msc

#

and tell me your experience

fallow sky
rigid saffron
spiral onyx
#

costly 😦

rigid saffron
#

they were like 20% off or something like that when I bought them ¯_(ツ)_/¯

#

I think it was something seasonal

#

That was also the time when I figured out I have like 70 euro in amazon gift cards lying around for some reason

#

Or was it 50? Idk

#

Were a few gift cards

spiral onyx
#

btw random but tell me your life story

#

why do you live in germany and know russian and etc

#

where were you born and where did you move etc

rigid saffron
#

And then time went, I spoke russian at home and with friends in a similar situation and german everywhere else

#

It's shrimple my friend

spiral onyx
#

damn, can your parents adopt me?

rigid saffron
#

lol

fallow sky
#

don't worry, be happy

rigid saffron
#

If you are okay living in the toilet room or in a small box with my cat, maybe

spiral onyx
# fallow sky don't worry, be happy

i can't be happy i've been stressing about being drafted since i was 13 and i'll be stressing about it until i'm 30 what part of this makes me eligible for happy

rigid saffron
fallow sky
#

like he says, In every life we have some trouble But when you worry, you make it double

spiral onyx
#

i don't mind making it double

fallow sky
#

we need to take the life like she's

spiral onyx
#

i do not care about cheap optimism i want to be realistic and actually see what's ahead of me

fallow sky
#

hm

spiral onyx
#

and ahead of me is the high potential of being drafted to army and thus my life going down the drain

rigid saffron
spiral onyx
#

unless i get lucky and manage to get a job in IT after i'm 23 and work there for 7 years straight

fallow sky
#

here it is

#

not perfect

#

but it's working

#

(in the form of a plugin for testing purposes)

#

@spiral onyx do you have github?

spiral onyx
#

ofc

#

@RoughlyUnderscore

fallow sky
#

wanna be in the org?

spiral onyx
#

i doubt i'll contribute much, if anything

fallow sky
#

it's not a problem

spiral onyx
#

i'm doing maths all day and i have 4 projects that i'd rather be working on

#

if i make it 5 nothings gonna change lol

rigid saffron
#

I'll test my gradle plugin today, after that I will make a repo and push my code

spiral onyx
#

i mean sure you can add me if you feel like it

fallow sky
fallow sky
#

waw

spiral onyx
#

this is just the beginning of what i was gonna do today

fallow sky
spiral onyx
#

wdym?

fallow sky
spiral onyx
#

yep

fallow sky
#

nevermind, i was joking x)

#

what is the goal ?

spiral onyx
#

find all values of a so that the system has 2 solutions

#

i solved it graphically because there is an obvious circle equation, a line equation and a line bundle

fallow sky
#

hmm

spiral onyx
#

delta what?

fallow sky
#

delta has two possibles values if I mind correctly

rigid saffron
#

Sadly my brain is too slow today to realize what is happening there

spiral onyx
#

not exactly sure what you are trying to say

fallow sky
spiral onyx
#

oh that's trigonometry

fallow sky
spiral onyx
#

it's also fun

fallow sky
#

yeah, just not really precise

spiral onyx
rigid saffron
spiral onyx
#

or in this case, a parametric system of equations

spiral onyx
spiral onyx
#

so

#

imagine an equation

#

as simple as

#

2x + 4 = 12

#

it's obvious that x = 4

#

now imagine this equation

#

2x + a = 12

#

in this case you cannot find the exact value

#

but you can find the value in terms of a

#

it will be

#

x = (12 - a)/2

#

this is called a parametric equation, and a is called the parameter

#

but most often you are not asked to find values of x

#

you are asked to find values of a, so that the equation has some amount of solutions

rigid saffron
#

We went from remapping nms to parametric equations lmao

spiral onyx
#

for example look at this equation

#

ax = 10

#

we can find x

#

x = 10/a

#

but this only works if a != 0

#

so, for a != 0, x = 10/a (1 solution)
for a = 0, there are no solutions

#

this is the essence of parametric equations

#

there are also parametric inequalities and systems with parametric equations but they are basically all the same thing

fallow sky
spiral onyx
#

exactly

fallow sky
#

CAN'T DIVIDE BY ZEROOOO

spiral onyx
#

yep

#

parametric equations, most often, can be solved two ways - algebraically and graphically

spiral onyx
#

some can be only solved one way (either because the other way is too hard or just impossible)

fallow sky
#

hmm okay I see

spiral onyx
#

for example, find all values of a so that the equation x^2 - 2(a - 2)x + 4a + 5 = 0 has two roots and both are above 1

#

i'll break it down

fallow sky
spiral onyx
fallow sky
#

seems a bit difficult x)

spiral onyx
#

notice that this equation is a quadratic equation

fallow sky
spiral onyx
#

in this quadratic equation, the coefficients are as follows

#

a = 1
b = 2(a - 2)
c = 4a + 5

#

a is just a number, it can be any number. x is the unknown value

fallow sky
#

a is a constant

spiral onyx
#

a is not constant

fallow sky
#

a

spiral onyx
#

it is any number at all

#

it is a parameter, an everchanging value

#

this is what we are looking for

#

all values of a that conform to some condition

fallow sky
#

but

#

let me cook

#

is b = c ?

spiral onyx
#

not necessarily

fallow sky
#

because if it's equal

spiral onyx
#

they can be if a is a certain value

#

but that does not matter at all. this is still a quadratic equation in terms of x

fallow sky
#

2a - 4 = 4a + 5
2a = 4a +1

spiral onyx
#

take a look at it on paper

fallow sky
#

even

#

2a + 1 = 0

spiral onyx
#

you know quadratic equations, right?

fallow sky
#

never heard about that

spiral onyx
#

wait

#

you've studied trigonometry but not quadratic equations

#

?

fallow sky
#

wait

#

in two years

#

basically delta, I already introduced myself to that

spiral onyx
#

i have no idea what you mean by delta

#

but perhaps yes

#

so you know quadratic equations, right? can you solve this?
x^2 - 2x + 1 = 0

fallow sky
fallow sky
#

or

#

no

spiral onyx
#

?

fallow sky
#

for x^2 = 0 yeah

spiral onyx
#

you cannot solve this yet?

fallow sky
#

no

#

wait

#

if it's equal to 0

#

wait

spiral onyx
#

ok in this case i shouldn't be talking about parametric equations lmao, you should study these topics in an orderly fashion

fallow sky
#

I'll take my lessons

spiral onyx
#

dw

#

study at your own pace

woven arrow
#

why are you talking about parametric equations in the CVN thread 🤔

spiral onyx
woven arrow
#

no

#

i do not

spiral onyx
#

aw shucks

fallow sky
#

school is so overrated x)

spiral onyx
#

the solution's really cool though

woven arrow
#

real

spiral onyx
#

i love maths

spiral onyx
spiral onyx
rigid saffron
spiral onyx
#

well fuck me

#

i'll go eat my lunch

#

if there's something to eat

#

i don't wanna cook rn

fallow sky
#

If I mind correctly, I learned how to solve for some x with ² and without ² = 0

spiral onyx
# fallow sky huh

you shouldn't be trying to comprehend this rn, you need to study topics in the order they are presented

fallow sky
#

but not with x² + 2x + 5 or any constant

spiral onyx
#

parametric equations are studied in 11th grade in Russia, if even that

spiral onyx
fallow sky
spiral onyx
fallow sky
#

and it worked

spiral onyx
fallow sky
spiral onyx
#

the discriminant

spiral onyx
#

it is a convoluted topic that requires you to understand quadratic equations, logarithmic equations, square roots and absolute values, the equations of a circle, a parabola, a line, etc, and to be able to operate all of them easily

#

i thought i would try to explain an easy one in simple terms but i don't think i can do that if you do not perfectly understand quadratic equations yet unfortunately

#

dw about it though

#

again everybody studies at their own pace

fallow sky
#

there was a video I applied

#

it uses delta

#

let's make an infinite loop for fun

#

lol

rigid saffron
#

@fallow sky making the lib that loads plugins should be really easy

fallow sky
#

perfect

rigid saffron
#

I've sent the file with the methods, you can easily change some stuff to make it remap the jar from intermediary to current obfuscated

fallow sky
#

hum

rigid saffron
#

I've shown the method for converting obfuscated to intermediary, just invert it and it works

fallow sky
#

okay okay

#

I'll try

#

just pushing the update for the downloader of mappings on github

rigid saffron
#

👍

fallow sky
#

okay, let's try

#

I think I'll need your help a lot of times x)

rigid saffron
#

What exactly

fallow sky
#

so, I name it CVN ?

rigid saffron
#

Yeah

fallow sky
#

when thinking of it

#

humm

#

I'll see if I'm stuck

#

it's incredible being at this stage of development in only two days

fallow sky
rigid saffron
#

Fabrics tiny-remapper or something like that, you'll also need asm and mapping io for it to work. It itself does not seem to be availavbe as a dependency, I will probably fork and refactor it later

fallow sky
#

did you push it on github?

rigid saffron
#

I just dropped the tiny remapper in my src folder, but I would recommend you to install it into your maven local and depend on it like that

rigid saffron
fallow sky
#

the plugin

rigid saffron
#

Nah, still gotta test it

fallow sky
#

okok

rigid saffron
#

Ig if you shadow all the dependencies into the tiny remapper jar and then install it inside the local maven repo to then shadow it again you will have the lowest amount of dependencies that you have to shadow

fallow sky
#

yeah I see what you mean

#

let's make it works first x)

#

we'll see optimization later

#

huh

rigid saffron
#

?

fallow sky
#

it's a bit difficult x)

#

I think I'll need to shadowJar directly then put to maven local repo and after import, like you said

#

gradlew publishToMavenLocal 👍

#

perfectly working, for now

#

@rigid saffron I need to import specialsource too?

rigid saffron
#

Nah, that's only for remapping mojang to obfuscated

fallow sky
#

I can remove that?

rigid saffron
#

Yep

fallow sky
#

okay

#

so I'll only need to apply remapJarToIntermediary to the loaded plugins ?

rigid saffron
#

No, you'll need to rewrite that method to remapJarToObfuscated and then store the remapped jar somewhere else with maybe a hash, so you know when to reremap the jar, and then load the remapped jar

fallow sky
#

hmmm

#

first, I need to put mappings downloader in my maven repo

fallow sky
#

I didn't understand

#

how can I make remapJarToObfuscated without this method, and it's already made?

rigid saffron
#

The one present in my java file remaps mojang to obfuscated (see the javadoc)
The other one, which remaps to intermediary, remaps from obfuscated mappings.
The first one uses some files from buildtools and the proguard format, while the latter uses the .tiny format and does everything you want to do on runtime, just that you will need to make it go from intermediary to obfuscated instead of obfuscated to intermediary

fallow sky
#

okay

rigid saffron
#

If you can't figure it out I'll rewrite it a bit later

fallow sky
#

okay

#

I'll try

#

but I promise nothing x)

fallow sky
rigid saffron
#

Yeah

fallow sky
#

to make it remapJarFromIntermediary

rigid saffron
#

Basically

#

Yes

fallow sky
rigid saffron
#

Change two strings

fallow sky
#

NAMESPACE_FROM and NAMESPACE_TO ?

rigid saffron
#

Yeah

fallow sky
#

what are their values in your code?

rigid saffron
#

NAMESPACE_TO to official and NAMESPACE_FROM to intermediary and it should work

fallow sky
#

what do they represent?

rigid saffron
fallow sky
#

so the namespace are "official" and "intermediary" ?

rigid saffron
#

Yep

fallow sky
#

so it's

#
public String NAMESPACE_FROM = "intermediary", NAMESPACE_TO = "official";

/**
 * Takes in an officially mapped jar (an obfuscated one) and remaps it to the intermediary mappings.
 * @param jarFile       The jar file to remap
 * @param resultJarFile The file to save the remapped jar to
 */
public void remapJarFromIntermediary(Path classpath, File jarFile, File resultJarFile) {
    File mappingFile = plugin.getMappingFile();

    if(mappingFile == null) throw new IllegalStateException("Could not find mapping file !");

    TinyRemapper remapper = TinyRemapper.newRemapper()
            .withMappings(TinyUtils.createTinyMappingProvider(mappingFile.toPath(), NAMESPACE_FROM, NAMESPACE_TO))
            .build();

    try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(resultJarFile.toPath()).build()) {
        outputConsumer.addNonClassFiles(jarFile.toPath(), NonClassCopyMode.FIX_META_INF, remapper);

        remapper.readInputs(jarFile.toPath());
        remapper.readClassPath(classpath);

        remapper.apply(outputConsumer);
    } catch (IOException e) {
        throw new RuntimeException(e);
    } finally {
        remapper.finish();
    }
}```
fallow sky
rigid saffron
#

No, opposite

fallow sky
#

oh okay

#

that's all ?

rigid saffron
#

Yeah, but then you get a new jar and you gotta do some stuff to ensure it stays updated and that it loads

fallow sky
#

hum

#

how to load the jar...

rigid saffron
#

Well, first we need to ensure the users don't make a plugin.yml, otherwise spigot'll attempt to load it and error

#

We will need them to create something like a cvn-plugin.yml

fallow sky
#

but, we'll also need to load it as a plugin?

rigid saffron
#

Which will let us identify it is our plugin

rigid saffron
fallow sky
#

oh okay

#

Let's do the things about checks

rigid saffron
#

Oh, we'll also end up looping through all jars and checking whether they're ours

fallow sky
#

yeah

#

for sure

#

not a problem

fallow sky
#

@rigid saffron I need to go help my parents for smth, here is the cpde I already got

#

mappings-downloader is on github, you need to publish it to your maven local

rigid saffron
#

ok

fallow sky
#

@rigid saffron if a plugin doesn't have a plugin.yml, spigot throw an error, right?

#

so we can't put our plugins inside the plugins directory?

#

but we must put it in smth like plugin/CVN ?

inland spoke
#

beware that paper has their own plugin.yml these days I think

fallow sky
#

that's true

#

I need to try

#

PERFECT

#

no problem with that

#

there isn't any error

#

wait

#

I forgot this is paper

#

let's try with spigot

inland spoke
#

/shrug it might ignore these kinds of jars for what I know

fallow sky
#

I need to try

#

perfect

#

no error

rigid saffron
#

spigot will just think it's not a plugin and continue looping over the leftover jars

fallow sky
#

yeah

rigid saffron
#

I currently met this interesting problem

#

no idea why it happens

fallow sky
rigid saffron
#

hahaha

#

funny

#

I need some gradle expert

fallow sky
rigid saffron
#

no

fallow sky
#

hm

#

I'm starting to have something 🤓

rigid saffron
#

PluginLoader?

#

is it your class

fallow sky
rigid saffron
#

I swear spigot had an identical one

fallow sky
#
public class PluginLoader {
    public CVN cvn;
    public File plugin;

    public PluginLoader(CVN cvn, File plugin) {
        this.cvn = cvn;
        this.plugin = plugin;
    }

    public PluginType getPluginType() {

        try (JarFile jar = new JarFile(plugin)) {
            JarEntry cvnPluginYaml = jar.getJarEntry("cvn-plugin.yml");
            JarEntry pluginYaml = jar.getJarEntry("plugin.yml");

            // Is a basic plugin
            if (cvnPluginYaml == null && pluginYaml != null) {
                return PluginType.SPIGOT;
            }
            // Is a CVN plugin
            else if (cvnPluginYaml != null && pluginYaml == null) {
                return PluginType.CVN;
            }
        } catch (IOException | YAMLException ex) {
            cvn.getLogger().severe("Cannot read plugin type for " + plugin.getName() + " !");
        }

        // There is not a plugin.yml, neither a cvn-plugin.yml
        return PluginType.NONE;
    }

    public enum PluginType {
        CVN,
        SPIGOT,
        NONE;
    }
}
#

I picked up some code from spigot

fallow sky
rigid saffron
#

nah, keep it

fallow sky
#

okay

#

@rigid saffron for this:java File classpathJar = new File( System.getProperty("user.home") + "/.m2/repository/" + SPIGOT_GROUP.replace(".", "/") + "/" + SPIGOT_ARTIFACT + "/" + MINECRAFT_VERSION + "-R0.1-SNAPSHOT/" + SPIGOT_ARTIFACT + "-" + MINECRAFT_VERSION + "-R0.1-SNAPSHOT.jar" );

As we are at runtime, I should get the server.jar?

rigid saffron
#

yeah

fallow sky
#

okay

#

or maybe not

#

google first

#

nothing on google

fallow sky
#

@rigid saffron I think I'm done with the remapping system

#

I push this on github

#

but my question is : how I load the plugin as a spigot plugin after?

#

this is the last thing to do

rigid saffron
fallow sky
rigid saffron
#

enablePlugin then

#

or wait,

fallow sky
#

no

fallow sky
rigid saffron
fallow sky
#

huh

#

how?

rigid saffron
#

or something

fallow sky
#

yeah

rigid saffron
#

then we just implement the few thousand methods and done

fallow sky
#

x)

fallow sky
rigid saffron
#

we can probably just take the original JavaPlugin the plugin has, instanciate it, feed it to the custom plugin class and give it over to spigot

rigid saffron
#

all plugins provide a main class in their plugin.yml

#

we use reflection, instanciate it and enjoy

fallow sky
#

ooooh

#

let's do that

#

lemme cook x)

rigid saffron
fallow sky
#

I'll go eat x)

fallow sky
#

I push on github, so you can work, I need to go eat x)

rigid saffron
fallow sky
#

at PluginLoader#loadPlugin

fallow sky
rigid saffron
#

this is just the plugin class