Creating a Bubble Tea Mod for Minecraft

By Janelle Kwan
I created a Minecraft mod that allows the player to create a variety of bubble teas from scratch.
This mod adds the cassava plant to the game, to allow players to harvest, plant, and grow even more cassava. This cassava can then be used to create the ingredient needed for the tapioca pearls. Eight different drink flavours were added to provide a variety of options.

This mod was created using Fabric and written in Java. The code for my mod can be found on my GitHub.

Day 1

On the first day, I set up everything that would be necessary to start making my mod. I used the Fabric wiki to download their template mod and open it in Visual Studio Code. By follow the instructions in this video, I was able to organise and rename all the folders needed, and implement any changes needed on the template in preparation for my mod.

I ran the program to make sure that the code worked and started up Minecraft.
Screenshot of folder system
Apple bubble tea texture
Apple
Bubble Tea
Berry bubble tea texture
Berry
Bubble Tea
Watermelon bubble tea texture
Watermelon
Bubble Tea
Apple milk bubble tea texture
Apple Milk
Bubble Tea
Berry milk bubble tea texture
Berry Milk
Bubble Tea
Watermelon milk bubble tea texture
Watermelon Milk
Bubble Tea

Day 2

Screenshot of code adding drinks
On the second day, I added 6 different bubble tea items to the game. I followed this tutorial on adding food items, to add my drinks. I also created the textures for my drinks. I then tested my code and found that everything worked, however, the items had both the food animation and sound effect.

By watching this video, I was able to create a new item class to override the animation and sound effect with drink ones. Another feature I wanted to add to my drinks was a status effect. With the help of this video, I was able to add the regeneration effect to all my drinks.

Day 3

On this day, I created the items and textures for the other items/ingredients needed to create the drinks. I then used those items to create the recipes for my drinks, so players can actually craft the drinks in a crafting table. I used this tutorial to create the recipes.

I encountered errors in my code due to the ID I had used for the Minecraft water bottles, and discovered that using the ID that would make my code work would then allow the recipe to accept all potions as well as water bottles. To solve this problem I decided to use glass bottles instead.

Another issue I also noticed was that the recipe unlock feature (where when you get an item it shows all the items you can create with it), only showed after you created the item.
Screenshot of code adding other items
Cassava texture
Cassava
Uncooked tapioca pearls texture
Uncooked
Tapioca Pearls
Tapioca flour texture
Tapioca Flour
Tapioca pearls texture
Tapioca Pearls
Cassava texture stage 0Cassava texture stage 1Cassava texture stage 2Cassava texture stage 3Cassava texture stage 4Cassava texture stage 5

Day 4

Screenshot of recipe unlock codeScreenshot of crop code
This day I solved the previous issue about recipes unlocking. With the advice from a friend, I found out about misode which is a data pack generator. This helped me to created the json files needed to implement recipe advancements.

I added crops to the game so players can grow their own cassava. I did this by following this video tutorial.

Testing my code returned an error, which after going back over, I found was because I had placed a file in the wrong folder. Putting it in the correct folder allowed my code to work. Another error I had gotten was because I had used the wrong variable for the textures in the json files. By replacing crop with cross (as I wanted my texture to generate in a cross pattern), my program worked. When I was testing the growth of my crops I discovered that the last stage of growth was missing a texture. This was because the stages of growth start from 0 up to AND INCLUDING the final age.

Day 5

This day was spent fixing the texture error of the previous day by creating 8 textures instead of 7 for the cassava plant growth.

The rest of the day was spent taking a break and playing some Skyrim SE.
In-game clipping of growing crops
Cassava texture stage 6Cassava texture stage 7

Day 6

World gen codeVillager trade code
Today I had attempted to have my plant in the world generation of Minecraft by following this tutorial and making use of the data pack generator. I wanted my plant to be found only in jungle biomes. When testing I was unable to find any plants even when reducing the rarity of spawns. When I changed what blocks the crops could be planted on, they started generating in the chosen biomes, but that also allowed them to be planted by the player on any dirt block instead of just farmland.

Another feature I tried to implement was adding villager trades. I attempted to add trades that allowed the player to exchange emeralds for cassava from a farmer villager. However, no matter how many villagers I killed, none of them showed the trade.

Day 7

After consulting my friend, I created a duplicate crop block class, with the feature of being planted on any dirt, to be used for world generation. I also added more villager trades, and a wandering trader trade to see if they would show up. They didn't. After carefully analysing the tutorial video, I discovered this was because I hadn't put in a line of code in the initialiser function. After this, the trades showed up (RIP villagers).

When testing my code in survival mode, I discovered that the regeneration effect only worked in creative. To solve this I moved the status effect code to the food class from the override class.

I also added in cactus and chocolate milk flavoured drinks. With cactus bubble tea giving a slight nausea effect.
Crop copy codeWorld gen in-game
Initialise codeCustom trade code
Cactus bubble tea texture
Cactus
Bubble Tea
Chocolate milk bubble tea
Chocolate Milk
Bubble Tea

Day 8

Achievement code
Today I decided to add my own achievements to the mod by following this tutorial. I decided to add 3 achievements, all under the husbandry category. The first is an achievement for acquiring cooked tapioca pearls. The other two which branch from that one are: acquiring a cactus bubble tea, and drinking one of each bubble tea flavour.
Achievement screenshotAchievement screenshot
Achievement screenshotAchievement screenshot

Day 9

This final day I implemented some features I thought would make the mod better, and refined some code.

One feature I added was that bubble teas made with milk would also remove poison and wither effects. When playing around with the code I discovered why the status effects only worked in creative, and it was due to the order of the code in the override function.
Status effect code

Thanks for reading!

Below are some in-game screenshots of my mod in action.
Drinks floating on groundDrinks displayed in item framesOther items displayedWorld gen of cassavaFarmer tradesWandering trader trades