Started by
Mymann
on
Topic category: Help with Minecraft modding (Java Edition)
Need help with creating a block that function identical to a vanilla chest.
Requirements:
- 27 slots for items
- Can contain items
- Break items when broken
- Doesn't merge with other to create a double chest
- Have animations for opening and closing, can utilize Geckolib if needed (I have already created the model that is just an edit of the single Chest).
- Play vanilla chest sounds for when opening and closing.
Any help would be appreciated.
Edited by Mymann on Thu, 07/25/2024 - 16:47
make a GUI element with 27 "input" slots
go in the chest settings and activate "block entity" (the first checkbox) in the block entity tab, then select your gui in "bind this block to GUI" setting
select the "open bound GUI on right click" checkbox
set "size of inventory" to 27
deselect the "drop items from inventoy when block destroyed" checkbox
then for animations you need Geckolib but I already tried to do chest animations and I failed, so I hope someone else helps with that
Thank you your support, I was able to have everything else working only minus the animation part, I decided to just use the Geckolib plugin to have an animated block with set animations for it, that way I don't need to do any actual coding.
Now the only problem left is syncing up animation, idk why but the closing(3) animation is taking priority over the open(1) and using(2) animation, I need to name the animation as numbers because that is the only way to have it working, and despite that I set the the GUI procedures that play (1) when right-clicked and (2) while using and (3) when done using, the game plays (3) when open, then display no aniamtion and then play (3) again when finished.
I think I had a similiar problem with block animations once and that I solved It, I'll see if I can find that workspace somewhere in my files and I'll check if I have some kind of solution for you
Why thank you, I will also try to figure out a solution in the mean times, as a reference, here is my current method on how to get the animations played, the using and closing part are also formatted in a similar fashion, but only one animation is played.
So I checked that out, and I didn't really fix it I just found an ugly come around, I did some tests and I figured out that the trigger "when this GUI is closed" in the GUI settings doesn't work at all, I tried assigning it to other procedures but it doesn't work, I think that it could be a MCreator bug
What about the "GUI is being used trigger"? If that false then perhaps I can just have only the "Chest lid stay open" trigger for during the actual usage of the chest, and the lid will move on its own to that position and back down when it is done using, assuming that it will actual move the parts to the position and not magically place it there that is.
Also, in my test the GUI closed DID worked, I tested to have it play the chest closing sound and it did play, only the actual animation is glitched.
I think that your idea could work, I tested the GUI closed trigger with execute command "give @p diamond" and it gave me the diamond only after I closed the GUI and then opened it again, so I don't know what to say, It's just that trigger that works weirdly maybe
Nah, it doesnt work, the animation system for these animated blocks is honestly so finicky and janky that made me wasted a good 4 hours on this chest animation thing with no avail, like in all animations, there can be only one animation that it can run at a time, and never in the order that I want it to. I don't even have ab ugly workaround for this as well, kindof make me wish to just copy some code for the animating part but idk where to.
yeah, I even tried something with NBT and variables but it just doesn't work
If anyone has or know some sort of code I can out in foe the animation, it would really be appreciated.
Okay so I figured out how to get the animations working, basically there is an option in the "Visual" section to specify the number of animation procedures for the block, by default its 0 so you would need to increase it first.
Now the problem is I need a way for the Closing animation to cancel out the Using animatuon when done with using the GUI.
There should be a block to stop animations for blocks in the GeckoLib tab
you mean the stop any animation procedure block? I am figuring it out and it seems it doesn't really work for me. :(
At this point you should just do something that only changes texture when opened like barrels, chests seem impossible to make, I literally tried for one entire week in every possible way when I wanted one for my mod but nothing worked