MeteorDevelopment / meteor-client

Based Minecraft utility mod.
https://meteorclient.com
GNU General Public License v3.0
2.04k stars 770 forks source link

Auto Breed not working in Multiplayer since 1.20.5/6 #4609

Open EnderKill98 opened 2 months ago

EnderKill98 commented 2 months ago

Describe the bug

Auto Breed will not feed any animals, when holding the corresponding Item.

I did a bunch of investigation and found, why this happens. However this is Data/Datapack related and I have zero knowledge in that area and are not sure how to fix this.

https://github.com/MeteorDevelopment/meteor-client/blob/339cf2b801084dec188d505c4add4e86c2e463b1/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoBreed.java#L80-L90

Basically, the needed ItemTags are no longer included when the client is running clientside only. ItemTags are used by the various Animal Implementations (e.g. TurtleEntity) to determine whether an Entity can be breed with a certain Item. So animal.isBreedingItem will always return false.

In the class net.minecraft.data.Main, the function public static DataGenerator create(Path output, Collection<Path> inputs, boolean includeClient, boolean includeServer, boolean includeDev, boolean includeReports, boolean validate, GameVersion gameVersion, boolean ignoreCache) takes the argument includeServer.

Specifically, create is adding VanillaItemTagProvider, which includes the entries for the *_FOOD ItemTags only if that boolean (includeServer) is true.

As mentioned, I'm at a loss here, how I would force the client to just have includeServer be true all the time. It seems to be spawned as a new process, which makes mixins seemingly fail (I tried mixing into the Head of main and adding --server to args).

Not affected: Singleplayer / Open to LAN

In these mods, Auto Breed works normally. Somehow Minecraft then loads the server side (as part of the integrated server?). The client can then find these tags without an issue and do auto breeding.

Steps to reproduce

  1. Join a Multiplayer server
  2. Enable Auto Breed
  3. Spawn a Mob and hold the corresponding breeding Item

Meteor Version

Meteor 0.5.7-2087

Minecraft Version

MC 1.20.6

Operating System

macOS

Before submitting a bug report

crazymoose77756 commented 2 months ago

I was unable to reproduce this, I joined a multiplayer server and was able to use auto breed correctly. I tried both paper and vanilla servers.

EnderKill98 commented 2 months ago

Curious. I'll retest it later with the newest version to check if it might have already been fixed.

I did not test for this, but you might have luck, if you joined single player before joining Multiplayer without restarting mc.

Also the server I play on is 1.20.1 (using ViaFabric) and I also tested it on a testserver that runs on 1.19.2 (has current ViaVersion Plugin).

Maybe a native server would send you the item tags as some sort of dynamic registry?

As said, I'll try to give it some retesting later on.

Thanks for looking into this!

EnderKill98 commented 2 months ago

I did the retesting.

AutoBreed only works if you're in SinglePlayer, Open To Lan or any kind of Multiplayer Server that is native on 1.20.6 as well. The Server Software (Vanilla, Paper, etc) doesn't seem to matter at all.

My assumption here is, that ItemTags became part of the DynamicRegistry stuff. So it would now be expected to be sent by the server to the client.
Since non-1.20.6 Servers don't do that, the Client ends up with an empty ItemTag Registry. This shouldn't matter in practice, and therefore I don't see any reason why ViaVersion should "fix" this.

But anyone playing on a < 1.20.5/6 server will very likely not be able to use AutoBreed at all (I'm fairly certain the same will happen, when you use ViaFabric clientside instead of ViaVersion serverside).

Here is a demo, showing Auto Breed in SinglePlayer 1.20.6, Open To Lan 1.20.6, Paper 1.19.2 + 1.19.4 + 1.20.1 + 1.20.4 + 1.20.6 + Vanilla 1.20.6:

https://github.com/MeteorDevelopment/meteor-client/assets/117233381/f657a6ae-6be6-418e-8056-0098cf6b3a8c

I also updated Meteor to the newest released Dev Build in that Video. Specs, Mods and versions are all shown.

(Small mistake in Video: Purpur 1.19.2 is actually Paper 1.19.2 as can be seen, when I typed "/ver")