Breed Easy

  • check_circle Functions
                  • 24
                  • 25
                  • 8
                  avatar Valkon
                  Level 48 : Master Modder
                  19
                  This is based on code from Dispenser Breed Animals, so thanks ArnyminerZ for letting me use that.

                  With this pack animals are able to breed when they "eat" (come in contact with) their food items.

                  Being able to throw food to animals makes manual breeding quite a bit easier. But the neat thing about this mechanic is that it allows for farm automation using dispensers, droppers, water streams, or really any method that puts the animals in physical contact with their food.

                  I've tried to make sure the food will only be consumed if the animal is currently able to breed. This includes things like the breeding cooldown time, animals that have to be tamed first, and how tamed wolves require full health. Pandas will pretty much always eat bamboo though, and some other animals might have quirks I've missed.

                  I'm pretty sure all mobs that are able to breed are accounted for, as well as all their food types (most were in ArnyminerZ's datapack). But let me know if you find anything missing or not working.

                  If you need general info on breeding, check out the Minecraft Wiki, as that's what I've followed.

                  This pack is for Minecraft 1.14+
                  It can be made to work in 1.13 by removing references to mobs and foods added in 1.14 (which are #commented in the two fairly simple function files)! For now I'll leave that as an exercise for those who require it.

                  How to install
                  CreditArnyminerZ
                  CompatibilityMinecraft 1.14
                  Tags

                  1
                  08/13/2020 9:41 pm
                  Level 1 : New Miner
                  Nyfaria
                  on 1.16.1 this data pack makes my server Fall 200+ ticks behind.
                  1
                  08/26/2020 5:45 pm
                  Level 48 : Master Modder
                  Valkon
                  What server are you running?
                  1
                  11/19/2019 6:37 pm
                  Level 26 : Expert Unicorn
                  DerptyCraft
                  replace their breeding items with their corresponding meat. (like if cows could breed with steak) Cannibalism time!
                  1
                  10/19/2019 4:44 pmhistory
                  Level 1 : New Architect
                  Michael_
                  There's still a bug, if you drop a stack (64 items for example) and the animals breeding time is running, when this timer is over and the animals are ready to breed, 1 animal will consome all the items and not only one, because all the items are stacked into one.
                  1
                  09/23/2019 7:58 pm
                  Level 1 : New Miner
                  AmcUhrd
                  yo man. very nice looking datapack. i was wondering if you could help me. im trying to learn making datapacks, but i havent got a clue where to begin regarding the actual coding. i do get the general file structure and the way things like functions and tags are diffrent, but the actual coding is a real hassle to find any tutorials on. the general idea is that i wanna be able to dispense shears onto vines, just likt with sheep. either with changing the dispenser behaviour, or giving shears a right click ability. i hope you can help
                  1
                  09/24/2019 3:16 amhistory
                  Level 48 : Master Modder
                  Valkon
                  Ooo nice idea, but it's actually quite a tricky one, as there's no entities involved in that situation.

                  With commands there's no way to "select blocks of type" and dispensers and vines are both blocks. And while dropped shears are an entity, dispensers don't spit them into the world for selecting, but keep them in their inventory.

                  You could use a dropper and execute on the shears that get spit out, then if they're touching a vine, setblock to air, summon a vine item, then finally replaceitem shears back into the droppers inventory with damage applied. It's all pretty tricky, especially that last part.

                  Another way is to mark a dispenser with an entity from which you can run commands. There's a complex automated way to do this with scoreboard "used" objectives, invisible armour stands and raycasting to find where the dispenser was placed.

                  But to start with, a more manual way would be to put an item frame on top of the dispenser in game. Then you can run something like this in your main tick function:
                  execute as @e[type=minecraft:item_frame] at @s if block ~ ~-1 ~ minecraft:dispenser[triggered=true] run function yournamespace:yourfunction

                  Then in the "yourfunction.mcfunction" file run a bunch more execute commands to find which way the dispenser is facing, find if there's a vine in the block space in front of the dispenser, and if so setblock to air and summon the dropped vine item there.


                  I don't know how helpful all the above is, but that's how I would approach it. I don't personally have time to help you learn all the commands etc, and as I don't personally use vines much I probably wouldn't make this datapack myself, sorry.


                  But yeah, I learnt by watching a bunch of Youtube videos where they explain commands. Then once I had a bit of a handle on the commands, I found datapacks that looked like they did similar things, downloaded them and read through the mcfunction files. Then there's the wiki, which can be confusing to begin with, but helpful later on. It also helps to write and run single commands using the in game autocomplete when you type "/" in chat, then copy them into your function files. Knowing how to Google the right keywords is key to finding the info you need.


                  Finally, if you're interested in programming, I'd suggest not wasting time with MC commands, and instead learn Java and how to make Forge mods. You can do much more complex things that way, and knowledge of Java can translate into things outside of MC, and will enable you to easily learn other languages in the future if you so desire.


                  Wow this ended up being really long.
                  Hope this helps.
                  1
                  09/08/2019 11:41 am
                  Level 4 : Apprentice Mage
                  ecwwithgaming1
                  does it work with villigers
                  1
                  09/08/2019 4:53 pm
                  Level 48 : Master Modder
                  Valkon
                  No the villager breeding mechanic is different to other passive mobs.
                  Planet Minecraft Logo

                  Website

                  © 2010 - 2020
                  www.planetminecraft.com

                  Welcome