GithubHelp home page GithubHelp logo

zedwick / villageritemcollector Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 107 KB

A Minecraft datapack which allows villagers to pick up items when the gamerule mobGriefing is set to false.

License: GNU General Public License v3.0

mcfunction 100.00%
mcfunction minecraft

villageritemcollector's Issues

Accessing Inventory[1] does not always return slot villager.1 if it does not yet have an item in it.

execute as @e[tag=vic_current] store result score @s vic_carrotc run data get entity @s Inventory[1].Count 1

The NBT path Inventory returns an ordered array of items in the villager's inventory, but as it does not return empty slots, accessing an item via Inventory[1] will not consistently return the item in slot 1.

[23:28:31] [main/INFO]: [CHAT] [Carrot] Pre
[23:28:31] [main/INFO]: [CHAT] Villager has [{id:"minecraft:bread",Count:52b},{id:"minecraft:potato",Count:3b},{id:"minecraft:beetroot",Count:4b}] and item is {id:"minecraft:carrot",Count:19b}
[23:28:31] [main/INFO]: [CHAT] [Carrot] Post
[23:28:31] [main/INFO]: [CHAT] Villager has [{id:"minecraft:bread",Count:52b},{id:"minecraft:carrot",Count:22b},{id:"minecraft:potato",Count:3b},{id:"minecraft:beetroot",Count:4b}] and item is

In the above example, the villager had no carrots in slot 1, and 3 potato in slot 2. Inventory[1] returned the potato in slot 2 (Count:3b) and added that up with the carrots from the item stack (Count:19b), and finally added 22 carrots to slot 1.

There does not seem to be an alternative for reading the item from a specific slot.

May need to check all items in the Inventory to see if any match the item type we are looking for.

Allay cannot pick up items in Minecraft 1.19

Whilst not strictly "villagers", the functionality is essentially the same.

Allays have a single slot for matching items. The items only need to match the type they are holding, and can have differing nbt data (different enchantments, names etc.) but must obviously be able to stack with existing items in the slot to be able to be picked up.

Currently they will wait staring at the dropped item, and perhaps never return to the player. Would need to test what happens when they find an item which matches but cannot stack with items in their inventory.

Villagers planting/harvesting?

This is a very cool hack for the mobGriefing issue. Have you explored whether there’s a way to enable villagers to plant crops via datapack functions?

This solves only half the problem for automated farming, as while the villagers can pick up food items for breeder farms, the crops cannot be replanted automatically.

I was considering exploring whether it was possible modify this datapack to do this as well — but thought I’d ask if you went down this path at all already... thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.