#Using GitHub Patchsets to Mod Pumpkin

1 messages · Page 1 of 1 (latest)

spiral panther
#

This thread is the result of a chat in #general . The observation comes from Pumpkin's website saying that Pumpkin has a Comprehensive Developer API, while other Minecraft server software don't.

This idea does not refer to modding minecraft, or adding support to Fabric and Forge. **But modding the server itself, modding Pumpkin's internal logic. **

Apparently, it's not possible to mod program developed in Rust. So this suggestion is about discussing about the concept of patches. Patches would be "mods applied to pumpkin at compile time", it wouldn't be meant to replace plugins, it's meant to prevent forking. Instead of shattering a community by forks, like what happened with Bukkit/spigot/paper, we could give the advantage of forking to "patches". That way, we could still be able to build great things around the same big project: Pumpkin; instead of being in a situation where everyone fork pumpkin.

For example, a fork would be able to

  • reimplement different part of Pumpkin, like change Entities' AI behaviors, or make changes to the files in the assets folder.
  • Forks like purpur (disabling or customizing a lot of minecraft's default behavior via config files) could be a patch.
  • Minigame servers could be able to stop/delete behaviors they don't need without forking the whole thing (natural mob spawning, world generation, nether and the end dimension, disabling block placement without overusing events to block them)

It would also solve a problem we have: there's a lot of suggestions people make on this server that relies on internal logic, and it doesn't make sense to make this feature accessible from the plugin API. For example, the ability to customize the knockbacks for pvp servers, it wouldn't be a good idea to make knockback customizable from the plugin api because multiple plugin would be able to change it and cause conflict. And reacting to events to add or remove knockbacks has a performance impact. It could be handled via a "patch".

#

Modding Pumpkin itself

#

@minor sandal @primal void

primal void
#

I suppose, if Pumpkin were made much more modular and each individual thing was built as a library, it would be possible to dynamically load the library for each feature. These could then be substituted for modded implementations which would change the behaviour and work a bit like mixins.

But this would probably add a large runtime cost.

limpid plover
#

”Mods” can probably just be patchsets for versions. Iirc we plan to have maint branches for released versions, so mods could just make a patchset that adds some feature to that version. Then the patchset would be updated for each release like in vanilla

spiral panther
#

what do you mean by patchsets ?

limpid plover
#

Git patchsets

primal void
#

You can run git diff and pipe it to a file, then apply that patchset

minor sandal
primal void
#

then compile to apply

limpid plover
#

Its the same as a diff, but in a file, so you can git apply ”mod.ps

primal void
spiral panther
primal void
limpid plover
minor sandal
primal void
#

Basically, it's composition rather than inheritance (I guess is an analogy?)

limpid plover
#

So a mod could consist of client side forge and pumpkin ps. But keep in mind also that most mods people use are performance mods, and those can be done directly in pumpkin as improvements instead of mods.

primal void
#

I think patches are the best option. They allow you to pick and choose multiple changesets you want to install, while also making it really easy to implement them into Pumpkin itself if Alex decides to do that.

hoary pewter
#

We should aim to make the plugin api be able to cover all situations instead

primal void
limpid plover
primal void
limpid plover
#

The extractor supports forge (??) mods i think, so any mods that are written in clientside can be loaded in extractor and run, and put data in pumpkin, so then you can add the impl in the plugin.

spiral panther
#

i don't understand why you guys talk about forge

limpid plover
primal void
#

But if you have something that can't possibly be modified with plugins, you could download multiple different patches and apply them all (instead of having to choose a fork which only had one of the features you needed)

spiral panther
# hoary pewter We should aim to make the plugin api be able to cover all situations instead

I think there are situations where things shouldn't be part of the pluginAPI, I gave example for the knockbacks. But even entity AIs, I don't think it's a good idea to let plugin reimplement it, while patching pumpkin's core feels better.

I will soon try to work on a PoC of a minecraft minigame made with pumpkin instead of paper, there are features that will not be needed, and disabling them via forking pumpkin is nicer than using events to cancel them imo.

But I understand that it's not a concept that's not attractive for everyone

limpid plover
#

I mean, we could just give access to removing from the managers, if i understood your problem correctly.

primal void
#

That way, it could also be used to accomplish tasks similar to Minestom where you don't need all the vanilla behaviour.

#

For example, you could have a 'pumpkin_entity_spawn' plugin. If the API is written well enough, this could be just as performant as implementing it into the base.
Or at least it would be nice to modularise Pumpkin more so you could choose what functionality you wanted through cargo features or something.

kind steeple
#

If rust had inheritance, modding would be much easier

primal void
kind steeple
primal void
#

Oh wow, never heard of Valence, looks cool but isn't actively maintained like pumpkin is.

kind steeple
minor sandal
trim hollow
primal void
# trim hollow that would absolutely tank perfomance

I'm not sure it would be too bad as, if no plugin was registered to listen to the events, those events could just be ignored.
I don't know, I feel even if it does lower performance a bit, it would be worth it as a server software without good plugin support wouldn't be great for most servers.

hoary pewter
minor sandal
hoary pewter
minor sandal
#

and when you use the virtual keyword in cpp, you also use vtables

hoary pewter
#

Ye

radiant escarp
#

if you are not able to do this id prob end up forking

#

which i feel will become a trend in others finding pumpkin

hoary pewter
#

All inventory code uses dynamics

#

But I guess it shouldn’t be too hard to use in Player and so on

#

And we can always use boxed structs if we want sized

#

Hard part is that all logic would have to be traits tho

minor sandal
#

i dont see how inheritence would solve this tho

#

you have the same constraints in cpp

hoary pewter
minor sandal
#

oh

#

nvm then

hoary pewter
#

Issue is that if you just want to change a small thing you have to copy the whole trait

#

Which is not ideal

minor sandal
#

wdym?

hoary pewter
#

If you want to change knock back behavior you need to copy the whole trait including vanilla knock back code

#

And for small changes that’s not ideal

#

Like changing a variable

minor sandal
#

ohhh thats what you mean

#

hmm

#

unless you roll your own vtable

#

^ dont btw

hoary pewter
#

I think it’s best to try to have a good plugin API

#

And core changes would need to be forks

#

Cause there’s no middle ground that isn’t super inefficient or not customizable enough

minor sandal
#

you can use what @primal void proposed before, using git diffs and requiring the user to recompile manually when you use mixins

hoary pewter
hoary pewter
#

What features would absolute source control be able to provide that a plugin can’t

#

Apart from niche uses were a fork can be made

minor sandal
#

the feature is that you dont need to make it a fork, which also means you can have many mixins applied from different sources, while you cant really merge forks together (unless you do a manual git merge)

minor sandal
primal void
minor sandal
#

hyprland

primal void
# minor sandal hyprland

Oh yeah. I tried hyprland but it just seemed a little more complicated than I needed it to be 🙂
I'm happy with i3 and sway for now but maybe I'll switch sometime!

minor sandal
primal void
minor sandal
#

yeah its really cool therse a drop in replacement while im out here stuck on wayland lol

trim hollow
#

i was going to benchmark plugin events but rust is so painfully slow idk if i can do it 😭

trim hollow
#

its faster to check errors by doing cargo build than waiting for cargo check

primal void
primal void
hoary pewter
#

In my understanding mixins are used mostly client side anyways

primal void
hoary pewter
#

I’m all for opening up registries, but not sure if mixins are possible

primal void
#

That said, it would be nice if there was a way to modify the "vanilla" pumpkin behaviour

limpid plover
minor sandal
primal void
limpid plover
primal void
limpid plover
limpid plover
#

The only problem is if multiple plugins do that, they will probably end up overwriting eachother, which is not good. But ig the same is true for java mods

bronze crater
#

And I've seen multiple real-world cases of that so that's not that hypothetical of a situation

limpid plover
bronze crater
#

And this granularity is very useful for mod compatibility haha

spiral panther
#

I've read all the chat. It seems that:

  • For some, pluginAPI should cover more behaviors, so that we don't need modding
  • For the others, it's not an ideal solution, so you guys discuss about an alternative

Regarding the first one, there are things that (imo) shouldn't be accessible in the pluginAPI. In Bukkit's plugin API events are great because it's unlikely to cause conflicts. There's a priority list for event listeners, which means each listener react one after the other, and the no matter how many listeners cancel an event, only the first cancel it.

Giving plugins the ability to change global things at runtime feels weird to me, let's take the example of knockbacks: what happens if multiple plugins try to change the knockback's default value ?

There are usecases where plugins can't and shouldn't be the answer. And in those cases, people built forks.

Let's take a better example, purpur. It's a paper fork that lets the admin customize a lot of vanilla behavior thanks to config files. Things like "should all players go to sleep to skip the night ?" or "should advancements be broadcasted ?" It would be a nice addition to pumpkin, but it would also bloat its core, maybe it doesn't fit in it, or maybe it answers a really tiny portion of the community and isn't worth the effort. Someone might really need it, and Pumpkin's team has the right to disagree. In those cases, developers should have a way to make those changes to pumpkin without bloating the core.

I wanted to find a pattern that allows us to do all that without forking, Tekno suggested git's patchsets, which seems to be great for maintaining forks, rather than preventing them. Patches could be a way to build PoC for features that would be integrated in the cores, or be the thing that allows everyone to add things in the core without actually bloating it.

Sorry for writing so much

lilac narwhal
#

I havent read Everything, but 1.) patches are esentially what make up a fork of bukkit, so @spiral panther your idea doesn’t seem to be viable, and 2.) the current system doesn’t allow for implementing custom implementation of systems

#

On the other hand, @minor sandal ‘s implementation does, which, after some reconsiderandon, works by dynamic dispatch

#

Other solutions would involve ECS and idk how else we could enable custom implementstions without reglection

#

The most viable solution would be to implement packet wrappers ong

#

This way we could map to different modding APIs more easily

spiral panther
minor sandal
spiral panther
#

yeah i saw your warning

#

that's why i'm saying it will never happen

limpid plover
#

I want to clear up what i meant by patchsets as mods. I did not mean that you should create a branch with the features. That would destroy the point. What i meant was something like this:

  1. create a mods folder.
  2. gitignore it.
  3. add a script that applies all patchsets in that folder. First run the command with --check, to see if it will apply cleanly, or with --3way to add merge conflicts.

So, the patchsets are the mods. They modify the behaviour of pumpkin for a specific version. It never gets commited. That way, they are easy to share, and you don't have to decompile them to check that there are not backdoors like you have to with vanilla mods.

I am not saying that this is a perfect solution, but imo it's the best option considering rust does not allow modding, and the plugin api should not be made so that it hugely affects performance of the vanilla mechanics.

minor sandal
#

i dont see why plugins cant just be zip files which contain the library itself, and a folder with mixins, and when it exists, you need to use some cli to run pumpkin

#

seems like a bit of work, but also the most intuitive

primal void
#

I guess the main benefit of patchsets is that you can already do them. Just send someone a patchset and they can apply it themselves, no need to change anything about Pumpkin or add mod loading support or anything.

#

But it would be much better if sometime, we could get an actual mod / mixin loader in Pumpkin, just as you said, it would be a lot more work.

minor sandal
#

thats true, but also no one is using pumpkin yet

limpid plover
minor sandal
primal void
#

the goal should be for the plugin api to be large enough for that to not be needed for most people
Definitely. API support is much better than Mixin hacks!

#

mixins dont necessarily have to be put in at runtime
In that case, how would it differ from a patchset?

limpid plover
minor sandal
primal void
limpid plover
primal void
#

E.g. plugins are more for event handling and stuff, while mixins change vanilla behaviour in a deeper level

minor sandal
#

they both modify the game right?

primal void
limpid plover
minor sandal
primal void
# minor sandal they both modify the game right?

While they both change the game,

  • Plugins work with the existing game to add functionality, through things like handling events and sending packets and things to players. But if something is hardcoded into Pumpkin, plugins can't really change that.
  • Mods on the other hand could be used to change the base game, if the plugin API isn't able to. For example, you could completely change the AI of a skeleton with a mod. That wouldn't be possible with plugins as plugins mainly just listen to and act upon events.
primal void
minor sandal
limpid plover
#

Mods are very much more dependant on the source code, while plugins act upon events sent through an api.

An event can be anything, like a player joining, or jumping, or hitting an entity.

primal void
#
  • Hardcoded = in the pumpkin code, there are some things that pumpkin just does that plugins can't change. E.g. mob AI.
  • An event = ^^^ (@limpid plover explained above)
minor sandal
#

what is an api then, it continues to be an unnecessary spiral

primal void
minor sandal
#

wait i need to find someone and ask them if these explenations are enough

primal void
#

That's not necessarily what Pumpkin is, but it may help somewhat

minor sandal
#

omfg i know what it is

primal void
#

Imagine you are in a restaurant, you can see the menu, and you know the kitchen is making food, but how do you order it? You use the waiter.

The waiter is the API, it takes your request (your order) and takes it to the kitchen (the server) where it is prepared and brought back to you (the meal).

limpid plover
minor sandal
#

maybe, for me at least it seems unnecessary to divide those two, but sure ig?

primal void
#

As mixin-style plugins can't be done with rust -- without recompilation

limpid plover
#

And, you couldnt add plugins without compiling again. That would mean that the distributed binaries would never be able to run plugins

minor sandal
minor sandal
primal void
limpid plover
minor sandal
primal void
# limpid plover No it’s not. You cant have a binary modify itself

Exactly, the issue is that plugins can currently be just dragged and dropped into your plugins directory and linked at runtime. As mixins can't be linked at runtime, your plugin would somehow have to download the source code and patch it to compile a new binary while still running the server.

primal void
#

Pumpkin could check if a plugin contained mixins, but as Pumpkin is already compiled, it wouldn't be able to do anything about it as it would need to recompile Pumpkin to apply the mixins.

minor sandal
#

my biggest problem is that mixins in mods are usually not used for the core logic, they are tiny patches which interact with the rest of the code, so then you might need plugins which need certain mods, or you need to have mods which are actually also plugins

#

which becomes confusing

limpid plover
# minor sandal which becomes confusing

How is it confusing? You would just have two parts that you put in different folders. If you want to install mods in vanilla you usually first have to add a modloader, then a mod API, and then the mod. How is that less confusing?

primal void
#

You should almost never need patches, unless your server is particularly different and custom.

#

In general, plugins are fine.

#

But mixins can be released, used and then merged into the main Pumpkin when stable.

spiral panther
#

i do agree naming have an impact on how people will perceive the difference in plugins and mods. Both plugins and mods are terms already used in minecraft community. Plugins in Pumpkin have the same purpose and work the same as plugins in spigot/bukkit. But mods work differently as the ones in fabric and forge (if we take the example of teknosom's proposition)

Calling them "mods" and placing them in a "mod folder" would confuse people, while patches are pretty selfexplainatory, they patch the server itself, there's no mod loader when applying patches for photoshop cracks or stuff like that

minor sandal
limpid plover
#

But… the patches would be used to mod(ify) the server? So how is it bad naming?

spiral panther
#

cuz they'll think it's a new modding api and will compare it to fabric and forge

primal void
spiral panther
#

i can already see KasaiSora saying "a new minecraft server software appeared, they support both plugins and mods, but not compatible with forge and fabric ! they have their own mods, and we can't even create blocks with it" like it's a different purpose and it's confusing

limpid plover
#

I mean imo, mods are a better name for them, but it does not really matter. As long as we can agree that this is a good solution.

spiral panther
#

i agree that it's a good solution

minor sandal
#

im fine with it

limpid plover
minor sandal
#

they never get more than 5 votes

primal void
#

This mostly concerns just this thread though, so I think it's fine

#

Most people in #polls wouldn't have a clue what we're talking about 😂

minor sandal
primal void
spiral panther
minor sandal
#

to the source itself

limpid plover
primal void
limpid plover
primal void
primal void
#

I guess

minor sandal
spiral panther
#

I don't understand how can changes to a codebase can be placed in a mod folder

basically you make changes to pumpkin's codebase in a patchset, you can "download" that patch and put it in a folder that's ignored when you commit, and when you compile pumpkin git knows it should patch the codebase with the patch ?

primal void
spiral panther
#

i'm coming from the web development world, never heard of git patches, i'm sorry

primal void
#

So you'd need to run a separate tool which patched and built a new, different binary

primal void
limpid plover
spiral panther
#

ohhhh

#

okok

#

that sounds great and it seems like it doesn't require efforts/a lot of changes to the codebase

primal void
#

Yeah, you just run one command and then rebuild

#

.... unless you have to deal with merge conflicts... 🙁

spiral panther
#

i mean in that case that's on the "patch maker" 's responsibility

limpid plover
#

Yeah, right now, popular (vanilla) mods already make an effort to be compatible with mods in the same area

spiral panther
#

It would be great if someone could sum up tekno's proposition so that alex doesn't have to read the 215 messages we exchanged, so that we get his opinion on the topic

i'll do it when i come back home tomorrow if no one is able to

primal void
#

Sure, I'll get to that after I've documented some more of the codebase!

spiral panther
#

nice ^^

limpid plover
#

We could also make a draft pr with the proposed script and folder

primal void
spiral panther
#

i used my whole lunch break to talk about pumpkin 😢 going back to work...

primal void
#

And distribute the patch files

limpid plover
spiral panther
#

i was just realizing that patches could be very powerful for anticheats

#

see you guys ^^

primal void
hoary pewter
spiral panther
hoary pewter
#

And so on

spiral panther
#

oh

#

that would be great

#

but it's a different topic

#

both neoforge and fabric mods can create new blocks dynamically.

Pumpkin could send a json that describe blocks (their hardness, the took to break it, its texture in base64), and the neoforge or fabric mods could use it to register them on their end.

But I don't know how to make pumpkin support already existing mods

#

that's how a block looks like in the blocks.json file, i think it gives you what information minecraft mods need to make a proper block

primal void
#

Any sort of client-mod support would mean that Pumpkin needed to support the Fabric/neoforge api

hoary pewter
primal void
kind steeple
hoary pewter
kind steeple
primal void
#

Maybe one day we'll have pumpkin-client 😂

kind steeple
#

xD

#

Like, it wouldn't be bad to rewrite the client as well, it's design isn't much better than the server's

#

And realistically we can reuse pumpkin's existing networking and packet stack, just swapping which are sent and received, so realistically we'd mostly just be writing the rendering engine and a couple UIs and interactions

#

Like I'm not saying it would be easy, but it wouldn't be impossible

primal void
kind steeple
primal void
#

So I don't know if it's worth making a new API for this or just improving the existing one.

hoary pewter
primal void
#

Oh, I thought you were suggesting making a new API for interacting with client-side mods.

spiral panther
#

it's pretty unrealistic to think that mod developers (who are already bothered by the stupid amount of mod loaders they have to support) will make a rust port for pumpkin, no matter how much popular it gets.

If you truly want the mod community to consider pumpkin, you need to make the first path towards them. Porting a mod to pumpkin requires to learn a new programming language (rust), rewrite your whole mod for pumpkin and ensure feature parity (since the client needs to be compatible with the server mod you're talking of) and maintain it.

I think if you want pumpkin to be compatible with mods, you have no choice but to make a transition layers between pumpkin and the mod loader you want. And this will be hard without source code access. Happily, there are open source mod loaders, fabric for example.

It wouldn't have a big performance impact since the java code would call fabric API that will call pumpkin's internal API, so at the end of the day it's rust code that runs.

#

fabric itself is open source, but the minecraft mapping they used is open source too. It should be very helpful in that regard

trim hollow
#

its not possible

#

most mods use mixins, which we've already established arent really possible in rust, and even if they were, theres no way to reliably translate some arbitrary vanilla mixin to pumpkin's codebase

#

also mods can achieve the same thing in different ways, no gurantee that translating fabric api calls will cover a mod

spiral panther
#

I'm not very interested in that, it's a lot of work, and it makes sense for fabric modding community to use fabric for servers, can't compete with that. What I was implying is that you should run a jvm that runs fabric and its mod loader, and use the mapping to make a transition layer with some kind of interoperability. Which is a lot of work.

trim hollow
#

its not possible

spiral panther
#

expecting modders to make a rust port is unrealistic

trim hollow
#

yes but its possible

#

possible > impossible

spiral panther
#

possible but no one uses it is the same as impossible, gg you got a great piece of tech but no one uses it

trim hollow
#

if you want pumpkin to be some ace of all trades, its guranteed to fail

#

the scope is way too big

spiral panther
#

that's not my goal, i was giving my opinion on 4lve's messages

trim hollow
#

my point is, pumpkin will never support vanilla mods and thats ok

spiral panther
#

and I agree with that !

#

I do think though that you can create a mod that allows plugins to create new custom blocks, like a client side receptor for server modding

#

that would be great

#

but that's something different

primal void
trim hollow
#

that would be another huge feature that bloats pumpkin

#

if someone wanta to implement polymer as a pumpkin plugin, go ahead ig

#

but please dont make it part of pumpkin

primal void
#

To be fair, it's not actually much bloat. It's just the ability to change the block state or something

#

I did it with Bukkit before, can't remember exactly what it's called though

limpid plover
#

I’m pretty sure you can already implement custom blocks as easily as vanilla blocks

trim hollow
#

cant we just focus on implementing vanilla first

#

no one will use pumpkin if it has lots of cool features but all of them are unfinished and buggy

primal void
#

I'd generally agree we shouldn't be focusing on proper mod / mixin support, which is why I think the git patch system works quite well. As they can later be implemented into pumpkin if it fits the project.

spiral panther
#

Using GitHub Patchsets to Mod Pumpkin

primal void
#

I will say that this git patchsets thing is definitely not the best solution. It will probably cause lots of issues. But for now, as it's incredibly easy to set up, I think it's the best choice.

trim hollow
#

there could be a system like mixins to prevent conflicts, but it'd only work on source code

#

maybe, if you have 10 years of rust experience, understand how cpus work, and have a year to spare, you could figure out a way to mixin compiled native code

primal void
#

I don't think it's really worth it... at least for now!

#

But maybe at some point in the future, we'll realise we'd missed something and there's an obvious solution :D

spiral panther
#

It also prevents people to use modding for everything when plugins are enough (99% of use cases)

wide bone
#

I might absolutely be wrong, but including debug informations in the binary (e.g. the address of each and every function and variable) would allow mixins, no? However, if I am right and Rust does not have a stable ABI, this is yet another problem to solve
(Excuse me for my absolutely terrible English ^^)
EDIT - It's not a good idea, Rust's ABI is unstable, plus most ISA don't care about variables to use memory adresses and registers instead, so trying to do it would probably (certainly) result in an undefined behaviour

limpid plover
# limpid plover
poll_question_text

What to name mixins in pumpkin

victor_answer_votes

5

total_votes

6

victor_answer_id

2

victor_answer_text

Patches

primal void
minor sandal
#

thats because i mentioned the rule

#

therefore it must be broken

#

if the rule is kept silent, it does function

spiral panther
#

Suggestion: Using Git Patchsets to mod pumpkin

What observations led to this suggestion ?

  • The desire to mod pumpkin
  • Prevent Pumpkin to follow Bukkit's fate of forking hell cycle (bukkit > spigot > paper > pufferfish > purpurmc > leafmc)

Why is there a need for modding/ why aren't plugins enough ?
First, I want to empasize on the fact that we're not referring to supporting Fabric and Forge (client-side modding) on Pumpkin. We're talking about modding pumpkin itself, its internal logic.

There are two reasons why people made forks regarding the bukkit ecosystem:

  • Performance (spigot, paper, leafmc)
  • Specialized forks (purpurmc, pufferfish, tacospigot)

Pumpkin prioritizes vanilla feature parity, but it's not the case for everyone, one could argue they need mobAI, but not as powerful as vanilla, and implement some AI that's simpler and less performance hungry.

Regarding specialized forks, people made them because implementing their feature in the original project would bloat it. PurpurMC is a fork that lets admins fine tune their server via config files (for example, they can disable achievements broadcasting, or disable water in the end dimension completely). Since Purpur is pretty popular, you can see that there was a need for that, and it could be part of paper, but it doesn't fit in their vision, it would bloat it.

The goal here would be to give developers enough control on internal logic, without bloating the core, and without encouraging a forking hell cycle.

But it's also worth saying that everything shouldn't be part of the pluginAPI. Anything global, such as knockbacks, could be accessed from multiple plugins. What happens if multiple plugins modify the default knockback value ? Which plugin takes priority ? It could cause conflicts.

#

Why patches instead of mods ?/ What are patches
Cuz modding is not possible in rust, so the idea of patches is to save changes made to the codebase, in a sharable way, so that we all build around pumpkin instead of forking it and creating different projects

And I kind of like the idea that you have to compile pumpkin to mod it, as I said we're addressing really tiny usecases that's not in the scope of plugins, handling modding at runtime make it too easy to make drastic changes to the internals of pumpkin, and might cause more issues than benefits.

spiral panther
#

@solid oriole sorry for the ping, but i wrote that whole thing so that you could give your advice on patches without having to read the whole conversation

lilac narwhal
spiral panther
#

I mean, I see the purpose

hoary pewter
#

What about feature flags for plugins?

#

Choose between performance and plugin compatibility

solid oriole
#

also supporting Fabric and Forge would theoretically be possible since these mods communicate via packets

#

but at least the Server side mod would have to be desgined for Pumpkin them

lilac narwhal
kind steeple
#

Conflicts would be a huge pain

#

Hey here's an idea, what if someone made like compile-time mixins

#

Like it would work on the same principle as mixins, it would just be done at compile time (which does mean that you'd have to recompile each time you want to add something, but it would actually achieve the goal that we're aiming for)

limpid plover
# lilac narwhal How would patch-sets be distributed? Like github repos? And how is compatibility...

You can distrubute them like you usually distrubute mods. They are just files. remember when i helped with the macros? Those were patchsets.

So, conflicts would probably be a small issue. Most mods will probably not conflict, and if they do, it can either be raised as an issue to patch devs, or the server admin could resolve it themselves. Most server admins of bigger servers will probably want to be able to do that anyways.

spiral panther
spiral panther
lilac narwhal
#

Yeah I’m just confused like

#

If you want to apply multiple patches

#

That target the same internal server files

#

Is there some way to determine the ideal load order

limpid plover
lilac narwhal
#

Like a system that tries every possible combination until it compiles 💀💀💀

#

Also, is there a way for github actions to fetch the latest version of pumpkin and check if the patch file can be applied?

spiral panther
lilac narwhal
#

No I think it’s very easy to check if a patch can be applied (because it doesn’t need to be compiled)

#

It takes like 2 seconds

#

But idk how one would automate that

spiral panther
#

i never worked with github actions, can't say

kind steeple
# spiral panther how would that work ?

Well mixins work by changing or overwriting methods during runtime (so basically it's injecting code into the JVM), this would do the same except during compile time

limpid plover
lilac narwhal
#

Oh I just always did git apply patch.ps lol

spiral panther
lilac narwhal
#

And it told me if it didn’t work automatically

#

But ig order actually does matter

#

In the same way the order of merged commits to upstream matters

trim hollow
limpid plover
trim hollow
#

some of those rules can be ignored since source code isnt hard to target (as compared to bytecode)

#

but there still need to be compat considerations

#

for example, directly modifying a line should always be discouraged

lilac narwhal
trim hollow
#

or overwriting a method

lilac narwhal
#

But what happens if the patch would apply on an update version normally, but the baked in versioning presents the patch from being applied?

lilac narwhal
#

Like if nothing in the affected file changed between commits

kind steeple
# spiral panther oh ok, but how does that differ from patchsets ? I guess patchsets would be able...

Patchsets could also achieve the same thing, but a bit differently and I'd say they're more prone to merge conflicts. With patchsets you're modifying the source code and saving only the changes without any context. If two mods try to change the same code, you run into a conflict, since git doesn't know how to handle these two changes at once. With mixins, it's more like hey, find the tick method, and add a call to one of my methods, which is stored in a separate file somewhere. Because of these very specific rules (add line before/after, remove function call, overwrite, etc.) it's much easier for the computer to automatically resolve the same area being changed by multiple mods

limpid plover
#

Yeah, patchsets are version agnostic as long as the file in source does not change, but the further it goes from when it was written, the more chance for conflicts. But The patch devs will have a pretty easy time updating and checking, so should be pretty easy to have a webhook on new pumpkin version, and check for conflicts.

limpid plover
spiral panther
#

so the debate here is: do we use git, or our own system, to basically make the same thing, inject code in the source code at compile time

kind steeple
limpid plover
spiral panther
#

i just fear that it will add complexity and needs for maintenance, while the idea was to find a pattern to mod pumpkin without adding weight on the main contributor's shoulders

#

if it's just git patches, no one else than the patch dev will have to manage it, if we do our system, it's our responsibility to maintain it with alongside pumpkin so that the tool continues to work

limpid plover
spiral panther
#

i'd be glad to see 🙂

kind steeple
#

Also you've got to admit that having something like

#[inject(target = "pumpkin::entity::player::Player::tick", at = "HEAD")]
fn my_mod_player_tick_mixin(self: &Arc<Player>, server: &Server) {
    // This code will be inserted at the very beginning of the PlayerEntity's tick method.
    println!("My Mod: Player {} is ticking!", self.gameprofile.id);

    // You could also call your own custom functions here.
    my_mod::player_events::on_player_tick(self, world);
}

Would be cool

limpid plover
kind steeple
#

Yeah, that would be the hard part, but rust's macros are quite powerful, I'd be willing to bet it would be possible in some way or another

wide bone
#

It looks a lot like Fabric/Forge mixins'

limpid plover
kind steeple
limpid plover
kind steeple
#

That sounds interesting, thanks!

spiral panther
#

omg...

limpid plover
#

So then we will have Pumpkin Seeds and Pumpkin Patches 🤔

kind steeple
#

Good question, might be a while

sick trellis
serene lichen
#

Huh

radiant escarp
#

is this still gonna happen ?

trim hollow
#

it doesnt really matter, its far future

lilac narwhal
#

Shouldn‘t bee too hard