Tschipcraft / spawnanimations

Hostile mobs dig out of the ground or poof into existence when they spawn!
https://tschipcraft.ddns.net/spawnanimations.html
Other
11 stars 2 forks source link

update to 1.20.5+ #28

Open sa-shiro opened 2 months ago

Tschipcraft commented 2 months ago

Thank you for the pull request. While updating the particle commands is a good start, it's unfortunately not enough. The main broken part of the data pack is the entity hiding system (located in the ehs folder) as it deals with item data which has been completely overhauled. Additionally, I'd like to use overlays instead of overwriting files in the main data folder to maintain backwards compatibility and not draft a new edition just for 1.20.5+

sa-shiro commented 2 months ago

Oh what? This is weird it worked for me when I tested it.

I'll have a closer look again later!

sa-shiro commented 2 months ago

What I suspect is that I forgot those changes when I forked the repo as I made modifications a while ago to have a working version for 1.20.5+

So basically started fresh when forking

Edit: I don't quite understand what you wanna say with "overlays" however why don't you create different branches for different versions?

Or do you mean like if Minecraft 1.20.4 executes 1.20.4 commands instead of the 1.20.5 ones?

Tschipcraft commented 2 months ago

With overlays, I mean additional folders that load and overwrite certain files in specific versions. They can be added in the pack.mcmeta file. I haven't used them in this project yet since it wasn't necessary, but you can take a look at the dev branch of one of my other projects, dynamiclights for reference.

It's not like the data pack will not load or appear to work without the necessary changes. However, loot will not be saved and restored, and I believe there may even be a chance that mobs will drop chest items.

sa-shiro commented 2 months ago

Ahh those overlays, didn't think you meant Datapack overlays 😅 (hence the override question) I'll update the branch when I have time

sa-shiro commented 2 months ago

The tag for the chest inventory is ArmorItems[0].components.minecraft:container (only if it contains items) however i didnt find a way to properly insert items into it without the inventory being filled with items to be replaced with..

When the chest is filled (for example with sticks in slot 0 - 3) replacing them works, but inserting somehow doesnt wanna work... im thinking of replacing the chest with a bundle (especially because i already have a command for inserting items into it) )and see if that works, gonna try it when i have the time

What i hate the most that there is literally no documentation about most of the commands stuff... only basic command structure, tags etc you have to find out yourself

I didnt have a close enough look to the entire datapack, is there a reason why you remove and hide the armor?

Tschipcraft commented 2 months ago

Thanks for actually taking on the challenge. Bundles have been disabled in some versions or moved behind an experimental flag, so using chests would be better for backwards compatibility, the syntax shouldn't really be that different as well as they are both container items, but I would have to check.

Admittedly, there is literally no documentation on my behalf other than what the functions themselves do, since I never expected anyone to actually contribute to it (here we are) and it was enough for me to remember what the parts do. If you're unsure what something does, feel free to ask. Also, don't feel pressured to complete this update, I'll do it when I get the time. I'm going to focus on dynamic lights first, since that's where I got the most bug reports of it not working in 1.20.5

I remove the armor to better hide the mobs (#3, #6). Actually shoving them underground would prevent mob farms from working, but would resolve a lot of issues (especially hiding glowing eyes from spiders and enderman). Another idea I had was a mode that doesn't care at which distance the mobs are from players and just always plays their animation, but didn't get around to implement.

sa-shiro commented 2 months ago

ahh okay makes sense, i didnt mean your datapack with doc, i meant the commands in general, beside the wiki which offers just the basic command structure, there is nowhere a detailed list of possible arguments without trial & error or actually looking into the src of minecraft, but yeah tbh this is my first time actually messing with mcfunctions and commands stuff :sweat_smile:

with the overlay approach it would only be used in versions where bundles exist and it isnt really hidden behind experimental flags, the item exists without, the recipe is just missing to actually get the bundle in survival It used to be the "same", but now its seperate: Bundle: minecraft:bundle_contents Chests: minecraft:container

from https://www.minecraft.net/en-us/article/minecraft-java-edition-1-20-5

minecraft:bundle_contents

minecraft:container

some better debugging would make stuff so much easier to get to know which function throws a error, its not always visible (like with the latest pr, something throws / spams a error, but idk where it occures)

Tschipcraft commented 1 month ago

Excellent pull request, considering it's your first time messing with commands, respect 👌

I tried to finish the pr and updated the rest of the item tag references to components (e.g. .tag.TsSaRemove to .components.minecraft:custom_data.TsSaRemove) (the thing that spammed errors was probably the predicate that only checked for chest items and not bundles), but I noticed that bundles unfortunately don't save empty item slots and therefore don't keep the correct order for the armor items. For example, if an entity is only wearing a chest plate, it needs to be put back on the body slot, and not suddenly on the feet slot because that's the first item in the bundle's item list.

Chest items now behave somewhat similar to this, empty slots are also removed. The slot information is stored in the following format: "minecraft:container":[{slot:0,item:{id:"",count}},{slot:1,item:{id:"",count}},{slot:2,item:{id:"",count}},{slot:3,item:{"id",count}}] instead of: [{id:"",Count},{id:"",Count},{id:"",Count},{id"",Count}], so the NBT data will look like this if an entity is only wearing a chest plate: "minecraft:container":[{slot:2,item:{id:"",count}}] and searching for a specific value in a list is pretty difficult to do in Minecraft..

I will have to think a bit on how I could implement this, one idea would be to use a container item with 4 container items in the correct spots holding the actual items?

sa-shiro commented 1 month ago

Yeah i figured that out too that empty slots are being stripped off so you cant even store "air" as a empty slot workaround, it has to have a item

however i didnt find a way to properly insert items into it without the inventory being filled with items to be replaced with..

due to their massive change, this is going to be hard to be implemented

Perhaps we could use a armor stand stored somewhere inaccessible and invisible to the player? would may be a better approach than the containers inside a container

Tschipcraft commented 1 month ago

I don't want to deal with entity linking, and having an armor stand for every hidden entity would be a bit much. Containers inside containers sounds better to me lmao. I will come back to this after my finals in approx. 1 month