All Tropical Fish Collection

All Tropical Fish Collection

637 Downloads

1.20.5+ update

zer0p1us opened this issue ยท 26 comments

commented

Hi, I don't what the intent is with this project as far as updating goes but I've had a look at reimplementing the advancements in the new component based system (1.20.5+ and datapack format 33+). I've hit a wall in progress, the issues is documented on reddit. Long story short the nbt tag has been removed and replaced with components the following:

"items": ["minecraft:tropical_fish_bucket"],
"components": {
  "minecraft:bucket_entity_data":{
    "BucketVariantTag": 67502593
  }
}

Naturally caught fish will also have a health tag inside minecraft:bucket_entity_data. Unfortunately in the current state there needs to be an exact match so something like this should work:

"items": "minecraft:tropical_fish_bucket",
"components": {
  "minecraft:bucket_entity_data": {
    "Health": 3.0,
    "BucketVariantTag": 67502593
  }
}

However health is implicitly converted to an int, which breaks the advancement. I don't know that there is a workaround for this at the current moment, I'm told this is a bug. Whether this will be fix or when, no idea. But I thought I would leave this here if anyone else is interested in trying to upgrade the datapack, or looking for an updated one

commented

Hi, I have no more ideas than you. I found your bug ticket, I'm posting it here to keep track: https://bugs.mojang.com/browse/MC-272531

commented

I've added another bug, much simpler this one as it just restores previous functionality so there is some hope it would get fixed sooner MC-272893

commented

Been trying to update this pack myself for 1.21.0

Running into the same problem with the new Item Component matching.

Did however find this works which could (in theory) be done via a function...

execute if items entity @s hotbar.* tropical_fish_bucket[minecraft:bucket_entity_data={BucketVariantTag:67699456,Health:3.0f}] run advancement grant @s only tropicalfish:dasher/cyan/pattern_yellow
execute if items entity @s inventory.* tropical_fish_bucket[minecraft:bucket_entity_data={BucketVariantTag:67699456,Health:3.0f}] run advancement grant @s only tropicalfish:dasher/cyan/pattern_yellow

That would obviously need that generated out for each variant to be checked against.

commented

@EclairDeFeu360 told me he may have found a solution, he will check this week end if he has some time

commented

Been trying to update this pack myself for 1.21.0

Running into the same problem with the new Item Component matching.

Did however find this works which could (in theory) be done via a function...

execute if items entity @s hotbar.* tropical_fish_bucket[minecraft:bucket_entity_data={BucketVariantTag:67699456,Health:3.0f}] run advancement grant @s only tropicalfish:dasher/cyan/pattern_yellow execute if items entity @s inventory.* tropical_fish_bucket[minecraft:bucket_entity_data={BucketVariantTag:67699456,Health:3.0f}] run advancement grant @s only tropicalfish:dasher/cyan/pattern_yellow

That would obviously need that generated out for each variant to be checked against.

how would that work in terms of performance? does it need to be checked each game tick or can it be done once and set? cuz its one thing to check everygame tick for one or two but when dealing with 3k of them I would expect some serious lag issues

commented

MC-272893 was resolved as "working as intended", so that route is closed, quite disappointing as that was the most promising resolution

commented

Even with the old method, the game has to be evaluating all those advancements anyway.

commented

Fair enough, seems like it will end up being the only viable solution

commented

how would you set up the advancement in that? you're handling the trigger in the command, are you leaving the advancement trigger just empty?

commented

The only other idea I had, but couldn't figure out the command to do it, would be to check the players inventory for any tropical_fish_bucket and remove the Health value from them.

commented

Yeah I can appreciate that. I even tried putting "Health": 3.0f in the json but that didn't work either.

commented

The only other idea I had, but couldn't figure out the command to do it, would be to check the players inventory for any tropical_fish_bucket and remove the Health value from them.

I wanna avoid messing with the vanilla item data, there was also the possibility to use the custom data tag to inject the BucketVarientTag when they get picked up but I wanna keep them as vanilla as possible

commented

Yh no tried the same and a bunch of other iteration to see if I can get to convert to a float, I did come up with a workaround of if you use some value that cannot be converted to an int like 2.5 and somehow managed to do 0.5 damage to a fish before catching it would work, but again quite dangerous and silly

commented

WIP #8 (currently broken), @EclairDeFeu360 will recheck it later

commented

Merge request merged, here are the packs, I will leave the issue open if you find problems
TropicalFish-resource.zip
TropicalFish-data.zip

commented

Would it be possible to remove the "custom_data" after the checking for advancements or is that kinda timing not possible? it feels like its kinda soiled the items to leave that data in, after spending countless hours catching these only for them to be technically non vanilla, the custom_data sticks around even when you release the fish and re-catch it

commented

I don't think the advancement would have the time to trigger between the two change of the item, but yes it is possible to remove back de custom_data et re-giving the item. The custom_data has to be on the item for every player that gets the fish, so I don't see the interest in removing it.
I don't understand what you mean by "technically non vanilla", vanilla means you use the version.jar given by Mojang without any modification, data pack are vanilla and this data pack use only vanilla mechanism.

commented

Thats okay, just wanted to keep the items "clean"

commented

I understand, but I don't think I'll touch the method until Minecraft makes it easier.

commented

Feel free to send a merge request if you find a better way to do it @zer0p1us

commented

What was the solution in the end?

I'm still working with the execute if items ... advancement grant method.

commented

When the player gets a tropical fish bucket, the BucketVariantTag is copied into custom data components that can be easily detected by advancement.

commented

Yeah we already tried that (see thread above) but the problem is getting it to also either match or ignore the Health attribute that was alongside it. Can't currently be done in a predicate as there is no item sub-predicate for the bucket data.

commented

With the new solution, we didn't copy Health, so no problem.

commented

Got an answer for MC-272531, using "minecraft:bucket_entity_data": "{Health:3f,BucketVariantTag:67502593}" will do the trick, still will need the health but at least now it works correctly, then you can have one for each level of health, like 0.1, 0.2, ... 3.0

commented

Fair enough, seems like it will end up being the only viable solution

Just a quick update. Been running my "execute if items" method on a community server since 29th June with great results and no noticeable performance impact.

Wrote a new script to generate all the datapack files, which can be found at...
https://github.com/davepusey/TropicalFish/tree/davepusey