The Plantspeaker
The Plantspeaker allows players to quickly reproduce various ground plants like flowers, leaves, and saplings.
Terminology
There are four grass fields where the plants appear. These are called zones.
- The southeast zone is zone 1.
- The northeast zone is zone 2.
- The northwest zone is zone 3.
- The southwest zone is zone 4.
Each zone is a 7x7 area and each grass block has an armor stand above it. These are the block markers.
Each zone has a hopper attached to it. These are simply referred to as the zone hoppers. The hopper for zone 1 is the zone 1 hopper, the hopper for zone 2 is the zone 2 hopper, and so on.
The cauldron in the center is simply referred to as the cauldron.
Underneath the surface of the Plantspeaker is the control room. This is where the operation takes place.
Along the center of the room, stretching west to east, are the item references. Each represents a plant that can be reproduced by the Plantspeaker. Each armor stand wears an item on their head and is inside the matching block.
How it works
Each of the item references has a unique score on the flora_pit
scoreboard objective. This is its ID. 0 is the Ghast Tear, which produces random plants. The rest do not matter as long as they are unique.
When an item is inserted into a zone hopper, each item ref armor stand copies the data from its head slot to compare it against the data of the item in the hopper. If the item does not match, the item ref will mark itself as not matching. If all mark as not matching, that means that the item inserted is not one that the Plantspeaker accepts, and it will be cloned to the dropper to be returned to the player.
If there is a matching item ref, the item frame is set from its head slot and the zone score is set from the item reference's ID to remember which item to reference. Each zone has a different score so that different plants can be grown at the same time.
When a honeycomb is dropped into the cauldron, it begins the growing sequence. First, all block markers check whether their block is empty. If it is, they mark themselves as empty. This is done to ensure no plants are replaced. Then, the plant setters are activated.
There is a plant setter for each zone. First, they choose a random empty spot on their zone to be the next plant location. If the selected item for the zone is a ghast tear, a random item ref ID is chosen. Otherwise, the next plant is set from the ref ID. Then, it activates the planter.
The planter is the last step in the process. It takes the next plant score that was just set and asks the item ref with that ID to clone its block to the planter. It will clone a 2-block-tall area to accommodate for larger plants. It will also remove any glass, which should be used to ensure plants do not grow. The planter will then clone the blocks in the planter to the next selected location, mark it as not empty, and mark it as not the next location.
The plant setter is on an 8-tick redstone loop where each plant setter activates 2 ticks after the previous. When there are no more empty spots in a zone, that zone setter will de-activate itself. Because blocks are only marked as empty in the beginning, players cannot endlessly harvest the plants while they are growing to keep the process going. Once all the spots that were empty at the start are filled, the process ends.
Adding a new plant
New plants are frequently added to Minecraft in content updates. Here is a step-by-step guide on how to add a plant to the Plantspeaker.
- Choose a spot for the item reference. The references are arranged by ID west to east, north to south.
- Summon an armor stand with the following command:
/summon minecraft:armor_stand <x> <y> <z> {Invisible:true,Marker:true,Small:true}
- Stand inside the armor stand and set its head item with the following command:
/item replace entity @n[type=minecraft:armor_stand] armor.head with <item>
Replace <item> with the item that you want to add.
- Place the item that you want to add on the same block that the armor stand is standing on. You may replace the ground with a specific block if needed. You may also place glass to prevent the growth of the plant, if needed.
- Check and increment the max ID. On each of the plant setters, open the second command block in the chain. At the end of each, there is a specified range from one to a number. Increment that number by one. Do this on each of the zone setters.
- Stand inside the armor stand once again and set its ID to the max you just specified in the command blocks with the following command:
/scoreboard players set @n[type=minecraft:armor_stand] flora_pit <number>
Replace <number> with the number.
Congratulations! You are done. Don't forget to test that it works properly.