Lootr (Forge & NeoForge)

Lootr (Forge & NeoForge)

66M Downloads

Server side only fork possible?

michael-lloyd-morris opened this issue ยท 4 comments

commented

Would it be possible to make a variant of this mod that runs server side only? I realize that would mean taking out the status coloration of the chests and the requirement to crouch to destroy them, but it would make servers running the mod more accessible.

commented

I've done Java programming before, just not in Minecraft, so if the owner thinks it's possible to make this mod I'll take on the project myself and issue a pull request down the road. I just don't want to go down a blind alley with a codebase I'm not familiar with.

commented

tl;dr: I'm sure it's possible to make a similar mod that is server-side only, but I think it would be a lot of work, and it would probably have issues that I haven't foreseen below.

Implementation-wise, you would most likely have to rewrite the entire mod. The use of Forge events is a strong possibility, but you might run into issues with hoppers and items being lost. More extensive use of ASM or mixins is also a possibility.

Relying on providing a separate block to place (or replace) is very easy, and what Lootr does, but that relies on block registration (along with block entity), which is one of the primary reasons it can't be server-side only.

As far as re-implementing goes with these methods, the issues that would need to be considered would be:

  • you would need a viable way of identifying a chest (block position and dimension might be reliable in Vanilla only; once tile entity movement becomes a thing, you're screwed)
  • potentially a way to add identifying information to a chest
  • a way to properly inject the per-player Loot instead of the chest's actual contents so that it is properly transmitted to the client

Asides from implementation, two other concerns cropped up in the past (1.14 replaced the chest block entity):

  • Overhead issues (modifying the default chest would propagate to every Vanilla chest)
  • Properly handling hoppers and other methods of interacting with chests (and the resulting "item loss/destruction")
  • (ed) double-chests destroying loot/potential weird interactions with double loot chests

There might have been other issues but those are the two (ed) three I specifically recall.

Given this, about the only code I imagine that would be reusable from the mod currently would be the loot storage system.

I don't really have any suggestions or ideas on how you could progress from those points, however. I diverged from modifying the Vanilla tile entity very early in the development cycle (when I did the 1.15 rewrite) primarily to avoid having to deal with them.

Finally, the code base is MIT licensed, so you're welcome to try this out, but I wouldn't be able to offer any advice beyond what I've said above.

commented

I guess my personal thoughts on the matter are basically: the scope of changes required is most likely quite vast, whereas you could just ... use Lootr in its current form.

You would already need to convert your server, so the only additional steps would be having people install Forge and Lootr on their clients. With a launcher like CurseForge, GDLauncher, ATLauncher or MultiMC, this is a breeze; even installing Forge manually into the Minecraft launcher is a simple process.

If there's reluctance from your players to run a modded client due to the complexity -- it's no longer as complex as it used to be. It also opens up the opportunity to use countless other mods. I guess there can be other reasons for reluctance, but given the benefits (and the potential to use other mods)...

commented

Thank you for your time. I'm going to go with papermc for the server, so I have to translate this approach to that system. You bring up several points that I hadn't thought of. I have seen mods that can run on vanilla client that introduce their own blocks, but they are limited to the existing block models. For example, claim block systems using an ore to mark the claim center point.

Papermc has a loot api, but nothing akin to what this mod does in place at current. Still, hopefully that will be a workable starting point.

In any event thanks for your time.