GeyserMC / Geyser

A bridge/proxy allowing you to connect to Minecraft: Java Edition servers with Minecraft: Bedrock Edition.
https://geysermc.org
MIT License
4.75k stars 686 forks source link

Add support for server resource packs #210

Open Seeburschbanause opened 4 years ago

Seeburschbanause commented 4 years ago

What feature do you want? If there is a custom server resource pack on the Java Server, let the Bedrock Edition download it and apply it.

Alternatives? Make the same resource pack for Bedrock Edition yourself.

Heath123 commented 4 years ago

This probably won’t happen soon because it’s not that important, but it should eventually

samolego commented 4 years ago

This is quite complicated probably since Bedrock doesn't use same resource pack format as Java does. You'd need external tool to convert it ...

Heath123 commented 4 years ago

Geyser could do it eventually

allnought commented 4 years ago

Maybe a resourcepack could be specified in Geyser that it would then send to players when the server tries to send one. This way server owners could specify one for the bedrock players, without Geyser having to have some crazy complicated resourcepack traslation module.

lukeeey commented 4 years ago

The bedrock client only accepts resource packs during the login sequence. It would be necessary to implement a server transfer using the transfer packet or somehow cache the resource pack before the player even joins geyser.

Its a tricky one.

EOT3000 commented 4 years ago

being worked on rn

WesleyVanNeck commented 4 years ago

@EOT3000 no it isnt

WesleyVanNeck commented 4 years ago

or are you working on it

EOT3000 commented 4 years ago

yes

YoutubeNosios commented 4 years ago

Hey ! Could you add ItemsAdder plugin support please ?

lzlrd commented 4 years ago

@Heath123 @lukeeey this, https://github.com/ozelot379/ConvertJavaTextureToBedrock, may help with implementing the said feature.

I've tested it with a few resource packs and seems to work quite well. It is also maintained and up-to-date.

rtm516 commented 4 years ago

Yea we have started writing our own library for it using that as a base, thanks for the heads up though.

Madis0 commented 4 years ago

I am also in favor of separate resource packs instead of requiring a Java Edition one and converting it. Or at least a config option to choose which mode to use.

SirOMGitsYOU commented 4 years ago

I would be happy with initially requiring the conversion of the resource pack then later on down the line separate ones because at least you can get something early our and people can start testing with it.

rtm516 commented 4 years ago

Currently, the resources branch will load in a valid bedrock resource pack and send it to the clients, we plan on expanding this to auto-convert java packs and offer the client the opportunity to use it.

SirOMGitsYOU commented 4 years ago

Is the resources branch updated to 1.16.1?

rtm516 commented 4 years ago

Not yet, I will get it updated after 1.16 is merged into master

LoneDev6 commented 4 years ago

https://github.com/GeyserMC/Geyser/pull/1076#issuecomment-671391655 a missing feature which is needed to add support for https://github.com/GeyserMC/Geyser/issues/1114

LoneDev6 commented 4 years ago

#1076 (comment) a missing feature which is needed to add support for #1114

Hello! Is there any news on the CustomModelData feature? Thanks! :D

Camotoy commented 4 years ago

@LoneDev6 Hello! I assume CustomModelData requires resource packs, yes? I am not well-versed with resource packs at all but this may require Java resource pack translation first. Alternatively, once the API branch is merged in, it could be possible to create a stepping stone extension.

LoneDev6 commented 4 years ago

Yes it's handled by resourcepacks. Basically client renders a different texture/model based on CustomModelData NBT attribute of the item. Idk if there is a similar feature in Bedrock clients and resourcepacks. We could fake the Bedrock equivalent attribute in order to show the right texture/model to the client.

Maybe someone has experience on this.

Camotoy commented 4 years ago

OK, so: 1: CustomModelData is a Java native thing (I did not know this!) 2: It's literally a tag called CustomModelData. 3: The CustomModelData items are defined through the resource pack.

The final point is a very, very good thing. It means that the work we have to do for Java -> Bedrock resource packs can be more or less used to get custom items - likely an internal cache of Java item + NBT to Bedrock ID. Now, I'm not sure about 3D items in Bedrock, but this GIF of Lucky Islands on CubeCraft Bedrock is promising: https://cdn.discordapp.com/attachments/206325275733131264/752897050689011731/lucky_uwu.gif EDIT: that might be a Java screenshot, oops.

LoneDev6 commented 4 years ago

Yea it's just an int NBT attribute which the client recognizes and allows the game to replace the item with a custom model/extruded texture. If I recall there is an equivalent thing in Bedrock but it's better as you can specify a literally new item in the game with its own namespace and id + custom model, but I'm not experienced with Bedrock so I don't know.

Anyway, you can join my test server and see Java CustomModelData in action: test.plugin.ga (1.16.3)

Camotoy commented 4 years ago

https://bedrock.dev/ is an excellent site for learning about Bedrock behavior/resource packs (though I believe behavior packs tell the server how to control item/block/etc behavior, so we don't need to worry about that). So the only hurdle is that Java resource packs can be prompted at any time, more or less, but Bedrock needs the resource packs at the start of the game.

Camotoy commented 4 years ago

@LoneDev6 I did get CustomModelData-to-Bedrock work started, so it is possible! Just needs some work: https://cdn.discordapp.com/attachments/605540865103888395/766000214728507432/Screenshot_from_2020-10-14_14-10-49.png

3D items appear to be possible, but difficult. https://wiki.bedrock.dev/tutorials/custom-item-models.html#3d-item-models Doing that programmatically, as well as any possible conversion between Java model format to Bedrock model format, is not something I'm desiring to do, so I'm just focusing on getting the 2D texture to work. Is there a guaranteed way to determine the 2D texture that should be used for items? Is it always layer0?

The conversion code is here and you can see the code implemented into Geyser on my personal resourcepackconversion branch (this part should mostly be done. For anyone who likes to try branches out early: this is not ready; there is no cleanup/caching of resource packs).

Camotoy commented 4 years ago

(There is still more work to be done on CustomModelData if it doesn't work when joining your server! That is a tomorrow project)

LoneDev6 commented 4 years ago

That's amazing, very good job! Maybe you can check BlockBench code which loads .json Minecraft Java models and saves them into Minecraft Bedrock compatible models and port it to your converter :D https://blockbench.net/

AnhvietPlays commented 4 years ago

Hello,

Has there been any update on this lately?

Thank You!

LoneDev6 commented 4 years ago

@DoctorMacc Sorry for the ping! Is there any news over this conversion feature? Thanks! :D

rtm516 commented 4 years ago

DoctorMacc Sorry for the ping! Is there any news over this conversion feature? Thanks! :D

@LoneDev6 Last I checked we are waiting on 1.16.100 to release for bedrock to continue this due to some features it adds

LoneDev6 commented 4 years ago

Very cool, let me know if you have any news in the future :D

Kas-tle commented 4 years ago

Curious if you guys would be willing to add durability onto this as well. I assume the strategy being taken is just passing it off as a custom item as far as the bedrock client is concerned? This would be quite helpful for servers that still use durability based models due to backwards compatibility with older versions (Pre 1.14). Durability is simply passed in NBT as the "Damage" tag on the same level as "CustomModelData". I will also note one minor complication here is that as of the 100 betas an icon can no longer be defined for a custom item in a resource pack, as this now all seems to take place at the behavior pack level, so I think the proxy would also have to pass that as well.

AnhvietPlays commented 3 years ago

Version 1.16.100 is now out! YAY

murasana commented 3 years ago

Ty for working on this <3

Kas-tle commented 3 years ago

@DoctorMacc

3D items appear to be possible, but difficult. https://wiki.bedrock.dev/tutorials/custom-item-models.html#3d-item-models Doing that programmatically, as well as any possible conversion between Java model format to Bedrock model format, is not something I'm desiring to do, so I'm just focusing on getting the 2D texture to work. Is there a guaranteed way to determine the 2D texture that should be used for items? Is it always layer0?

Not sure you ever found an answer to this but just wanted to clarify in the case that you did not. Since you are only tackling items then yes this is a reasonable assumption as there will, at minimum, always be a layer0 for any item using a parent path that ultimately leads back to builtin/generated. Since you are only tackling texture-based changes here this makes sense as anything that is just texture based for the model (referring to when there is no actual model, so the game just creates it by extrusion of the texture) is going to ultimately lead to builtin/generated.

That said, the only caveat is cases in which multiple layers exist. This really only occurs for leather clothing, filled maps, tipped arrows, potions, firework stars, and spawn eggs. In this case, you would have one layer which determines the shape of the item, and one layer that determines the overlay... trouble is that these are, for some inexplicable reason, not consistent. For leather clothing, filled maps, firework stars, and spawn eggs, layer1 is the overlay and layer0 is the base. For potions and tipped arrows, however, layer0 is the overlay and layer 1 is the base... So for true all purpose conversion of any item, you'd have to deal with these special cases somehow, but honestly it may not even be worth it as they're fairly niche...

Camotoy commented 3 years ago

If it weren't for leather armor I probably would not bother, but thanks for the heads-up and information!

To answer your previous question, durability is planned to be translated, as well as if the item is a food source.

Kas-tle commented 3 years ago

Thanks for the answer on durability. I was also wondering if there will be any option to still manually upload the pack that is sent to the bedrock client in the case that one wanted to just deal with the custom item model situation manually (referring mainly to implementing pseudo 3D items through attaching to the player geo).

Camotoy commented 3 years ago

Though it will require more discussion internally, I'm suspecting there will be an option for this.

Camotoy commented 3 years ago

Screenshot from 2020-12-05 16-41-38

Item properties now show up correctly! Work resumes.

YoutubeNosios commented 3 years ago

Screenshot from 2020-12-05 16-41-38

Item properties now show up correctly! Work resumes.

How did you do that please ? ( I'm using ItemsAdder but I don't have custom textures on Bedrock )

LoneDev6 commented 3 years ago

Very nice, did anyone try if ItemsAdder works with current builds of GeyserMC Spigot plugin?

rtm516 commented 3 years ago

Very nice, did anyone try if ItemsAdder works with current builds of GeyserMC Spigot plugin?

Do you have a test server? If so I can fire up a build and grab a screenshot.

Edit: I found it but its not 1.16.4 so I cannot join.

Camotoy commented 3 years ago

@LoneDev6 if you have a chance to update your test server or install ViaVersion (I did attempt to join but the server is still on 1.16.4) I'll be happy to try it out!

YoutubeNosios commented 3 years ago

Very nice, did anyone try if ItemsAdder works with current builds of GeyserMC Spigot plugin?

Do not work

Camotoy commented 3 years ago

Yes, the current master builds will not work. Resource pack conversion is only in my branch for the time being as it is still unfinished.

YoutubeNosios commented 3 years ago

Yes, the current master builds will not work. Resource pack conversion is only in my branch for the time being as it is still unfinished.

there is multiple resource packs branch on your account , wich one is it please ?

Camotoy commented 3 years ago

I would not recommend attempting to compile and use it yet. That being said, the branch is titled resourcepackconversion, but you won't get assistance for trying to run it.

YoutubeNosios commented 3 years ago

I would not recommend attempting to compile and use it yet. That being said, the branch is titled resourcepackconversion, but you won't get assistance for trying to run it.

I just want to try , I don't want to use it for now , I'll wait the release but is the itemsadder version updated ?

LoneDev6 commented 3 years ago

Sorry guys currently I have no time to test this in detail @DoctorMacc if you want you can send me a PM on SpigotMC.org so I can gift you a copy of the plugin. Obviously you have to write down your SpigotMc account name here on this Github ticket to avoid people faking your identity to get a free copy XD https://www.spigotmc.org/resources/73355/

rtm516 commented 3 years ago

Sorry guys currently I have no time to test this in detail @DoctorMacc if you want you can send me a PM on SpigotMC.org so I can gift you a copy of the plugin. Obviously you have to write down your SpigotMc account name here on this Github ticket to avoid people faking your identity to get a free copy XD https://www.spigotmc.org/resources/73355/

@LoneDev6 It should be https://www.spigotmc.org/members/camotoy.6153/ unless he got a new account or something.