No, you can't just make the item give back an identical copy of itself with use_remainder in order to apply a cooldown. You'd have to use the advancement/function with a give command if you were gonna do that. The problem with the component is that the copy would then need to also have a component which gives back a copy, and then that copy would also need it... and so on. You'd need an infinite amount of data to make it work. (As opposed to Loot Tables, where you can do some tricks to make them actually recursively reference themselves)
I used command blocks to do this so I couldn’t use advancements and I made it give back the same item but with a custom data component and use a command to replace it every tick with the right click detector
I may be wrong so please correct me if I am, but can’t you just have your component that gives your copy run a function which then has the /give command (or maybe /item to have it go to the right slot) for the item Like would that not work (I very much have no idea what I’m doing I only have a very basic understanding of this stuff)
as conure512 says, anything the player changes like custom names and/or enchantments, curses, dyes, trims, contents, etc... will be lost with this method of replenishing the item... instead - for items that you don't want to be consumed on-use; right now you're probably better off using a goat horn as the base item and customizing the instrument file it uses to change the cooldown length.
Fun Fact! This new system is not used by nearly as many vanilla items as you might think. Goat Horns and Ender Pearls have no use_cooldown component (it's hardcoded in both), the component is only present on Chorus Fruits; and the "animation" field is only used by potions. Yes, that's right, despite there being options for bow and spyglass animations, Bows and Spyglasses don't even use this component at all.
now waiting for them to realise not just food:{effects}, but potion_contents, suspicious_stew_effects and ominous_bottle_amplifier components are all redundant too and everything they do could be achieved with the consumable:{on_consume_effects} component by just adding a show_component flag to either show or hide the effects in the tooltip.
First thing I did when all this was first implemented was make a craftable blaze wand that spawned chargable fireballs utilizing fire charges as ammo. I can't wait for more awesome stuff to be possible!
Enchantments are doing well too, really excited about throwing snowballs/eggs/etc. getting projectile enchantment support and enchantability being abstracted into a component! The potential to make fully customizable enchantable tools like wands or whatever is looking very possible next update!
@@nati0598 if you increase the player's block interaction range attribute by one, you could technically place it behind the furthest block you can reach normally.
If you’re trying to do this with command blocks (so you can’t use advancements) you can make it actually consumed on use and make the item give you an effect with the food component and then detect that effect and replace the item
All we need now is custom item components and data for ingredients in recipes...as well as support for custom blocks and entities (Yes, it's already possible to make those. Still, having actual support would for those would be sick).
Also the fact that minecraft:use_remainder got added is pretty cool, you could have that blaze powder spell get replace with charcoal with consume seconds are up, or maybe you could have a 'loot bag', once it's consumed gives you a container/item with a custom loot table.
@@PotatoTheProgrammer Because that's much more difficult, code-wise, than you might think, given all the different possible block properties and behaviors.
@@KBRoller mostly its about performance too, since you know all the registries are locked and baked every time you load the game. Having datapacks change it dynamically is hella error prone
if they add a way to make custom usage animations in Java resource packs all my dreams would come true and I would implode of happiness. This has to be the most amazing snapshot for custom items/powers in minecraft
I'm really hoping they change the cooldown so that it's upon use or give us the option so we can choose when it gets applied. Still a great snapshot, though.
wow, they really decided to treat me specifically. Yeah I know they didn't actually, but they even added a tempt range attribute, something I was trying to do a while ago. gonna be annoying to redo all the commands, but it'll be cool once i do
I’m still learning these more advanced functions and whatnot, and I want to be able to do several things, but not sure how: Decrease bow draw time Detect which side of a block is being mined Mine additional blocks when mining I have small bits figured out, but the bulk of it I’m still not sure of I’m also hoping to do as much of this as possible as directly as possible
Decrese Bow Draw Time - Pretty sure it's not possible, that enchantment component is specifically for crossbows. Detect Side of Block - Again, not possible in any "official" way - you'd have to use raytracing, which is a somewhat complicated technique that I covered in my second video ever on this channel Mine Additional Blocks - You can detect the initial hit using a component, but not the actual breaking action. You'd basically need to use ticking commands that are constantly looking for a scoreboard objective that detects when you broke a block.
I find it interesting that Mojang contradicted themselves with the cooldown change. If I recall correctly, the goat horn cooldown starts as soon as the player clicks, so I wonder if this is a bug.
This cooldown system is based on Chorus Fruit specifically, which only starts after you're finished eating it. I know this because Chorus Fruit is the only item in the game, to my knowledge, that actually uses this new system. Goat Horns don't.
@@amthystxxgoat horn is an instrument, not a food. If I'm not mistaken, instrument's cooldown is tied to how long you want the sound to play (so you can't overlap sound events)
with the changes to the food component, I'm wondering how existing dummy items (like a poisonous potato) with "!food:{}" are updated.. whether it will automatically be made non-consumable because it wasn't before, or if it will have to be manually updated to remove the consumable component...
@@TheiBunny Exactly, you'll now have to remove the consumable component to prevent it from being consumed. This may very well cause upgrade issues for existing items, I have yet to test that
@@conure512 thanks to the massive changes to items between 1.20.4 and 1.20.5, I've already had to make my own custom data fixer for my old items anyway so its not a huge deal for me to have to update them again...I'd just prefer not to 😅
All of the files used can be replicated in regular commands! The command syntax just looks different. Here’s an example: /give regfunkid apple[consumable={sound:entity.blaze.hurt}] That command gives you (or me, since that’s my username) an apple which, when eaten, makes an awful noise.
hallo im very impressed with your video but i have questions do yo have any way to make when you type it shows you a reverse. im very need that thing. keep going 💥💥💥💥💥💥💥♥️♥️♥️♥️
I'm not sure if that one is an animation that's available, the "block" animation looks like how shield work and also doesn't seem to do anything at all in first person. It totally could become available in the future though
@@conure512 awww... And here I was hoping the block animation did that. If it's not too much for me to ask you, could you fill a suggestion form to have the old_sword implemented in a future snapshot? I would've done it myself but my Minecraft is « less than legal » which I assume will render my opinion voided. Also the animations for other player-like entities like Evokers' arms waving
Sure! It’ll look a little messy in a youtube comment but you can just copy this: [consumable={on_consume_effects:[{type:apply_effects, effects:[{id:(effect),duration:100,amplifier:0}]}]}] The easiest way to remember writing it is that “on_consume_effects” requires a *list* ([…]), followed by an *object* ({…}) which contains a “type” of effect application, in this case being “apply_effects”. After the type you need to then provide a list of effects in another *list* followed by another *object*. The first list ([…]) is for all your effect application types. The item can do multiple at once, not just one effect at a time. The second list is for each effect, separated by objects ({…}). The *amplifier* and *duration* areas are optional, but remember that *duration* is written in GAMETICKS, not seconds. So to make it last the time you want, calculate (time) x 20 = (result).
Didn't Mojang do something to goat horns on 24w33a to be able to make them fully data driven and configured in datapacks? I was wondering if it was possible to use that for cooldowns and right click detection...
@@Rikaisan Technically yes, but for some reason that still doesn't work with any item other than goat horns. it's just that you can make your own sounds now
@@conure512 Sorry if I'm ignorant, I'm not really a datapack dev, however, isn't it possible to use ma goat horn as a dummy item, use it for right click detection and use the `use_duration` field for cooldowns?
Just an idea. What if you had an item that is instantly eaten, then you do what is supposed to do but after that you schedule to give the player back the item at the end of the duration of the scheduled command.
@@enderallygolem This snapshot already has some on-consume effects, but most of them just have to do with granting or taking away potion effects. For now, at least.
regarding the cooldown not working as you'd hoped on items that aren't consumed, couldn't you have the item be instantly consumed and have the advancement give back an identical copy of the item when you do? it's probably not perfect but I think it'd still work fine I can't quite think of a workaround that'd get the exact behavior desired for the impulse gem though
@@conure512 how about use a 'using_item' advancement trigger and it will run a function that uses an item modifier that will modify nothing in their item except set the count to 1 (even if it's already 1) i think that would work
maybe use a using_item advancement trigger to run a function to set their movement speed attribute and reset it when they arent but that's kinda janky and will change the player's FOV
You can do this with commands! You just lose a lot of things (like custom recipes) without a data pack. That being said, data packs are REALLY easy to make, so give it a try!
No, you can't just make the item give back an identical copy of itself with use_remainder in order to apply a cooldown. You'd have to use the advancement/function with a give command if you were gonna do that.
The problem with the component is that the copy would then need to also have a component which gives back a copy, and then that copy would also need it... and so on. You'd need an infinite amount of data to make it work. (As opposed to Loot Tables, where you can do some tricks to make them actually recursively reference themselves)
I used command blocks to do this so I couldn’t use advancements and I made it give back the same item but with a custom data component and use a command to replace it every tick with the right click detector
you could, however, have it give you a dummy item, then detect said dummy item with an advancement to replace it with the usable item
I may be wrong so please correct me if I am, but can’t you just have your component that gives your copy run a function which then has the /give command (or maybe /item to have it go to the right slot) for the item
Like would that not work (I very much have no idea what I’m doing I only have a very basic understanding of this stuff)
@@Aurora.Astralis I don't see a reason why it shouldn't. You can just /give every player with the advancement in a tick function.
as conure512 says, anything the player changes like custom names and/or enchantments, curses, dyes, trims, contents, etc... will be lost with this method of replenishing the item...
instead - for items that you don't want to be consumed on-use; right now you're probably better off using a goat horn as the base item and customizing the instrument file it uses to change the cooldown length.
Fun Fact! This new system is not used by nearly as many vanilla items as you might think. Goat Horns and Ender Pearls have no use_cooldown component (it's hardcoded in both), the component is only present on Chorus Fruits; and the "animation" field is only used by potions. Yes, that's right, despite there being options for bow and spyglass animations, Bows and Spyglasses don't even use this component at all.
classic mojang 😂
That's actually so good of mojang to give us functionality they don't even use (yet)
I made a parrying dagger last update using a goat horn, but now I can hold it up indefinitely using new cooldowns XD
now waiting for them to realise not just food:{effects}, but potion_contents, suspicious_stew_effects and ominous_bottle_amplifier components are all redundant too and everything they do could be achieved with the consumable:{on_consume_effects} component by just adding a show_component flag to either show or hide the effects in the tooltip.
@@TheiBunnyprobably just hasnt been done yet as this is still a snapshot
I knew this video was coming as soon as i saw the snapshot 💀
I was about to post rhis exact comment, mojang already cooking with technical stufff
6:50 I mean the consumable also is for potions, so "can_always_eat":false only applies to food
First thing I did when all this was first implemented was make a craftable blaze wand that spawned chargable fireballs utilizing fire charges as ammo. I can't wait for more awesome stuff to be possible!
That sounds awesome! If you don't mind me asking, how did you make the wand use the fire charges as ammo?
You are the only person who scratches my oddly specific technical data pack itches ❤️ Really appreciate your videos!
"Can_always_eat: true" also describes me.
bro what this is actually crazy. an ACTUAL cooldown mechanic for functions is going to be so nice 😌 (at least for consumable items)
Enchantments are doing well too, really excited about throwing snowballs/eggs/etc. getting projectile enchantment support and enchantability being abstracted into a component! The potential to make fully customizable enchantable tools like wands or whatever is looking very possible next update!
I'm excited, but I am struggling to figure out how to modify item default components without commands
I'm so excited by what they're doing with all these components and functions. Datapacks are getting so dang powerful now~
Now I need left clicking detection
We've already KINDA got that with enchantments detecting left-clicks on blocks, but left-clicks in the air are still just barely out of our reach lol
Interaction entity in front of players head?
@@JoZaHandle Yes, but then you've gotta, yaknow... keep it there lmao
also it blocks the player's normal interaction abilities
@@conure512 Is it possible to keep it just far enough for the player to reach after everyhing else?
@@nati0598 if you increase the player's block interaction range attribute by one, you could technically place it behind the furthest block you can reach normally.
you're a real one for including the datapack file
Love how this comes out hours after I learned about it.
If you’re trying to do this with command blocks (so you can’t use advancements) you can make it actually consumed on use and make the item give you an effect with the food component and then detect that effect and replace the item
I wonder if we will ever get a good left click detection
Alright good just what we needed
damn ive likely created a weapon pack with old one detection, now I have to change AGAIN
All we need now is custom item components and data for ingredients in recipes...as well as support for custom blocks and entities (Yes, it's already possible to make those. Still, having actual support would for those would be sick).
technically we dont even have official support for custom items the way of making them is still technically a workaround
oh boy oh boy this is gonna get fun
Oh my god finally i can make my Megumin staff even better
More right click detection lets go
You snuck in the PhoniexSC quote and thought we wouldn't notice...
Mojang should differentiate consumable and useable items.
Also the fact that minecraft:use_remainder got added is pretty cool, you could have that blaze powder spell get replace with charcoal with consume seconds are up, or maybe you could have a 'loot bag', once it's consumed gives you a container/item with a custom loot table.
loot bags are doable with Bundles, no?
These changes are pretty epic :)
thanks for explaining this!
Only man excited for item components
I was expecting a video about this lmao
Mojang has been hitting it out of the park with their datapack stuff lately. We’re eating good!
why doesnt mojang just let us register custom blocks :(
Now we just need to be able to specify custom components on input ingredients in custom recipes...
@@PotatoTheProgrammer Because that's much more difficult, code-wise, than you might think, given all the different possible block properties and behaviors.
@@KBRoller mostly its about performance too, since you know all the registries are locked and baked every time you load the game. Having datapacks change it dynamically is hella error prone
Surprised you haven’t made a video about goat horn rcd, seems cool for custom abilities with a cooldown
if they add a way to make custom usage animations in Java resource packs all my dreams would come true and I would implode of happiness. This has to be the most amazing snapshot for custom items/powers in minecraft
I'm really hoping they change the cooldown so that it's upon use or give us the option so we can choose when it gets applied. Still a great snapshot, though.
wow, they really decided to treat me specifically. Yeah I know they didn't actually, but they even added a tempt range attribute, something I was trying to do a while ago. gonna be annoying to redo all the commands, but it'll be cool once i do
This absolute madlad seems to use notepad to edit data packs, respect++
same i use notepad lmfao
I'm making a minigame about magic an now I'm glad I haven't made the wands yet. I just have 1 or 2 items to fix.
I feel like we don't need server plugins in a few years anymore
dang thats awesome
I’m still learning these more advanced functions and whatnot, and I want to be able to do several things, but not sure how:
Decrease bow draw time
Detect which side of a block is being mined
Mine additional blocks when mining
I have small bits figured out, but the bulk of it I’m still not sure of
I’m also hoping to do as much of this as possible as directly as possible
Decrese Bow Draw Time - Pretty sure it's not possible, that enchantment component is specifically for crossbows.
Detect Side of Block - Again, not possible in any "official" way - you'd have to use raytracing, which is a somewhat complicated technique that I covered in my second video ever on this channel
Mine Additional Blocks - You can detect the initial hit using a component, but not the actual breaking action. You'd basically need to use ticking commands that are constantly looking for a scoreboard objective that detects when you broke a block.
pretty great stuff
I find it interesting that Mojang contradicted themselves with the cooldown change. If I recall correctly, the goat horn cooldown starts as soon as the player clicks, so I wonder if this is a bug.
This cooldown system is based on Chorus Fruit specifically, which only starts after you're finished eating it. I know this because Chorus Fruit is the only item in the game, to my knowledge, that actually uses this new system. Goat Horns don't.
@@conure512 Interesting.
@@amthystxxgoat horn is an instrument, not a food. If I'm not mistaken, instrument's cooldown is tied to how long you want the sound to play (so you can't overlap sound events)
@@cakeyeater7392 Yeah true. It would be cool if they added a parameter that makes it trigger as soon as you click, though.
with the changes to the food component, I'm wondering how existing dummy items (like a poisonous potato) with "!food:{}" are updated..
whether it will automatically be made non-consumable because it wasn't before, or if it will have to be manually updated to remove the consumable component...
@@TheiBunny Exactly, you'll now have to remove the consumable component to prevent it from being consumed. This may very well cause upgrade issues for existing items, I have yet to test that
@@conure512 thanks to the massive changes to items between 1.20.4 and 1.20.5, I've already had to make my own custom data fixer for my old items anyway so its not a huge deal for me to have to update them again...I'd just prefer not to 😅
Hi, I love this, but can you make a tutorial on how to do it without data packs? (If its possible) I just like command blocks more, thanks
All of the files used can be replicated in regular commands! The command syntax just looks different.
Here’s an example:
/give regfunkid apple[consumable={sound:entity.blaze.hurt}]
That command gives you (or me, since that’s my username) an apple which, when eaten, makes an awful noise.
hallo im very impressed with your video but i have questions
do yo have any way to make when you type it shows you a reverse.
im very need that thing.
keep going 💥💥💥💥💥💥💥♥️♥️♥️♥️
not gonna lie i have no idea what you're asking here, but thank you!
HOLD UP !
Dose this new animation component mean that we can have back the pre 1.9 sword blocking ?
I'm not sure if that one is an animation that's available, the "block" animation looks like how shield work and also doesn't seem to do anything at all in first person. It totally could become available in the future though
@@conure512 awww... And here I was hoping the block animation did that.
If it's not too much for me to ask you, could you fill a suggestion form to have the old_sword implemented in a future snapshot? I would've done it myself but my Minecraft is « less than legal » which I assume will render my opinion voided. Also the animations for other player-like entities like Evokers' arms waving
I've already made a datapack in 1.21 that adds back sword blocking and 1.8 mechanics so it's possible but now it can be made less janky
Hey im new at the datapack making, can someone show me how does the "apply_effect" inside of the "consumable" component work?
Sure! It’ll look a little messy in a youtube comment but you can just copy this:
[consumable={on_consume_effects:[{type:apply_effects, effects:[{id:(effect),duration:100,amplifier:0}]}]}]
The easiest way to remember writing it is that “on_consume_effects” requires a *list* ([…]), followed by an *object* ({…}) which contains a “type” of effect application, in this case being “apply_effects”. After the type you need to then provide a list of effects in another *list* followed by another *object*.
The first list ([…]) is for all your effect application types. The item can do multiple at once, not just one effect at a time.
The second list is for each effect, separated by objects ({…}). The *amplifier* and *duration* areas are optional, but remember that *duration* is written in GAMETICKS, not seconds. So to make it last the time you want, calculate (time) x 20 = (result).
@@bloxxer_tv tysm!! i was making two lists lol
Didn't Mojang do something to goat horns on 24w33a to be able to make them fully data driven and configured in datapacks? I was wondering if it was possible to use that for cooldowns and right click detection...
@@Rikaisan Technically yes, but for some reason that still doesn't work with any item other than goat horns. it's just that you can make your own sounds now
@@conure512 Sorry if I'm ignorant, I'm not really a datapack dev, however, isn't it possible to use ma goat horn as a dummy item, use it for right click detection and use the `use_duration` field for cooldowns?
Just an idea. What if you had an item that is instantly eaten, then you do what is supposed to do but after that you schedule to give the player back the item at the end of the duration of the scheduled command.
Did you ever figure out how to edit the animations with a resource pack?
3:55 how about making the item conusmable, but simply with using the "use_remainder" to leave itself?
You’d just be making a Russian doll. 🪆eventually you’d reach the last layer.
How long until we're able to run a function on consume to skip having any advancements?
@@enderallygolem This snapshot already has some on-consume effects, but most of them just have to do with granting or taking away potion effects. For now, at least.
regarding the cooldown not working as you'd hoped on items that aren't consumed, couldn't you have the item be instantly consumed and have the advancement give back an identical copy of the item when you do? it's probably not perfect but I think it'd still work fine
I can't quite think of a workaround that'd get the exact behavior desired for the impulse gem though
Is it possible to modify how long it takes for the bow animation to show it as fully drawn?
Not at the moment at least. The animations are hardcoded.
I dont know id this would work, but could you set the result item to be the same as it was before? Therefore making the burst gem work?
That's actually a great idea, BUT, the only drawback is that it would erase any custom data that the player had applied like renaming in an anvil.
@@conure512 and dont you also have to make the result item have the result item have the result item and so on?
@@Napaddd actually that's a very good point lol. with Loot Tables, infinite recursion is super easy, but they dont let us use those here lol
@@conure512 how about use a 'using_item' advancement trigger and it will run a function that uses an item modifier that will modify nothing in their item except set the count to 1 (even if it's already 1) i think that would work
Is there any way to make it so it doesn't slow you down?
maybe use a using_item advancement trigger to run a function to set their movement speed attribute and reset it when they arent but that's kinda janky and will change the player's FOV
You can get around it by making your item be used instantly, but instead have a cooldown applied after use.
This disappointed me a bit, not because the change isn't amazing but because it can not be done without data packs.
You can do this with commands! You just lose a lot of things (like custom recipes) without a data pack.
That being said, data packs are REALLY easy to make, so give it a try!