How to Add Custom Blocks to Minecraft Datapack Tutorial

preview_player
Показать описание
Loot Table Generator:

Download the tutorial datapack:

Download the Tutorial resource pack:

Discord Link:

Join our Patron server by supporting us on Patreon:
Get exclusive datapack updates and entire packs.

Learn about all the donation perks:

**My Favorite Minecraft Server Host**
Use Code "WASD" for 25% off your first month!

Chapters
00:00 - Intro
0:59 - Context
3:09 - Step 1
6:58 - Step 2
20:39 - Step 3
29:11 - Outro
Рекомендации по теме
Комментарии
Автор

Hey, if you want the base block to be something non transparent, simply add the following in the summon item display command:
brightness:{sky:15, block:0}
Then you can use stone or smth without causing problems!

ThatGeometryDude
Автор

It's fortunate fro you to upload this recently since I started getting back to making mods/datapacks. Awesome video!

uperM
Автор

I KNEW someone would finally use Item Displays to make custom blocks. I'm so happy that you did it.

uperM
Автор

Adding a custom item : 😃
Adding a custom block : 🙁
Adding a custom entity : 💀

NaClbs
Автор

For anybody here after 1.21, the folders in your namespace for the data pack (function, loot_table, and advancement) are no longer plural for consistency sake

gradypulley
Автор

Got this working in 1.20.5 prerelease 1! Had to port some item nbt to components of course, but ran into some other quirks too. Notably, item frames are no longer placed in the middle of a block, their position is actually in the wall of the block. Easily fixed with execute align tho! Also managed to get rotatable blocks by checking the y_rotation of the item frame, and fixed an issue that can happen with core blocks that aren't fully solid (slabs, end rods, brewing stands, etc.) with these two lines at the top of place.mcfunction:

execute if block ~ ~ ~ end_rod run function
execute if block ~ ~ ~ end_rod run return fail

just checks if the block already exists, and prevents placement. Avoids accidentally destroying vanilla blocks, or infinitely stacking custom blocks on a single block.
Great tutorial! I feel like I know how everything works, which is great cause now I can expand on it like this :D

Pacca
Автор

Now I can finally make my favorite coe block 🔥

iamabotatgameyt
Автор

For people using this tutorial, the place.mcfunction is slightly misaligned which leads to the issue demonstrated in the video.
summon item_display ~ ~ ~ {Tags:["wasd.red_emerald_block", "wasd.custom_block"], transformation:{left_rotation:[0f, 0f, 0f, 1f], right_rotation:[0f, 0f, 0f, 1f], translation:[0f, 0.47f, 0f], scale:[1.01f, 1.01f, 1.01f]}, item:{id:"minecraft:item_frame", Count:1b, tag:{CustomModelData:1}}}
REPLACE 0.47 --> 0.5
This then perfectly aligns the display on the block grid.
If your block goes dark (becuase non-solid) also add;
{brightness:sky:15, block:0}

DDRKhat
Автор

bruh I just came from an older video of yours(you do great tutorials btw thank you) and I was indeed trying to make a custom block.... and I indeed got it to look right in my hand and then I placed it and it wasn't the same... AND THEN in this video you describe that exact same thing... man you truly are good. Keep it up homie.

opstudio
Автор

EDIT: Dont listen to this, I'm not bright.
So good! A quick thing to note, I reccommend adding the following to the bottom of place.mcfunction if you are in 1.20.5+, it fixes the position of the display:

execute if entity @s[nbt={Facing:2b}] as @e[type=item_display, limit=1, sort=nearest] run tp @s ~ ~-0.47 ~-0.47
execute if entity @s[nbt={Facing:3b}] as @e[type=item_display, limit=1, sort=nearest] run tp @s ~ ~-0.47 ~0.47
execute if entity @s[nbt={Facing:0b}] as @e[type=item_display, limit=1, sort=nearest] run tp @s ~ ~-0.94 ~
execute if entity @s[nbt={Facing:5b}] as @e[type=item_display, limit=1, sort=nearest] run tp @s ~0.47 ~-0.47 ~
execute if entity @s[nbt={Facing:4b}] as @e[type=item_display, limit=1, sort=nearest] run tp @s ~-0.47 ~-0.47 ~

ThatGeometryDude
Автор

This is a great tutorial, I was struggling to figure out how this all works. You go through some of the resource pack stuff kind of fast though, it would be nice to also be provided with the resource pack. For example, I'd like to be able to fully copy the json for the block so I don't have to try and do it myself. Also, I'm not sure if I'm supposed to put custom model data in the block json.

Ubspy
Автор

19:25 unsure if there's a new thing for 1.21, but instead of changing the brightness values of the item display, i was able to use stairs or slabs (double or not). obviously, this isn't ideal but it gets the job done.

ktg
Автор

you only need to check for the block once every 2 ticks, 1 tick is too much, 3 tick may allow the user to get the original loot from the block
so you can use a function that schedule itself every 2 ticks

also what I personnaly like to do is to test if I can kill the item before spawning the item, that way I can chose the block depending on the tool I want the user to use + player in creative don't get the item when breaking it so it doesn't fill their inventory

Rignchen
Автор

Thank you very much for these tutorials, helped me out a ton! Also is there any reliable method for checking for blocks in line of sight(that blue line in hitbox)? Something like raycast or idk?

veruty
Автор

there's a solution for having both a specific block and having it light like it should, it's to have the item display 1 block above it and to use the translation tag to move the visible part where we want, however this does work really well for stuff like crafter but it doesn't work for stuff like decorative block as the block above/on the side will surely be filled with another block

Rignchen
Автор

So I'm assuming there's likely no way to make a block with certain attributes then.
Was somewhat interested in making a Jelly or Lubricant block, pm a slick frictionless surface that spiders would be unable to climb on or cling to, as well as somewhat working like Ice but harder to redirect yourself when walking. Maily intended to optimize my string farm.

Ayyylien
Автор

Hello, I followed the tutorial and modified the provided datapack and resourcepack to fit with my item but it shows up as the purple cube in the world, and its breakable and has the red stained glass sound when broken but it stays there forever, you can phase through it too. Any solutions? Granted my block isnt a cube moreso a medium sized fountain so maybe it can't work with this tutorial?

GloriousMinecraft-nj
Автор

Got the datapack function to work in 1.21
1. the pack folders do not use plurals anymore so "functions" will be "function"

2. the code string or whater you call it has changed as well. I got this to work and it gives me the item through the /function command I gave it.. I put generic info in this one so change it as you need:
execute as @p run give @s item_frame[custom_name='{"italic":false, "text":"ItemName"}', custom_model_data=1234567, entity_data={id:"minecraft:item_frame", Fixed:1b, Invisible:1b, Silent:1b, Invulnerable:1b, Tags:["Custom.item_frame_block", "Custom.ItemName_block"]}] 1

SOOO now that I have that working I can finally move on further in this video past 10 minutes lol

hope this helps and if I got something wrong please let me know.. but it works for me... for now

opstudio
Автор

How to change time to break this block?

Tadzik
Автор

okay I know I have been buggin the heck outta you and I appreciate how helpful you have been...I just have 1 last question.

When making the json file for the loot table... I put the json, in and as a test I just put the custom model data in there to see if the file path was okay and indeed it was. I broke the block and it dropped an item frame that looked like my block.

However, when trying to add the nbt data something is wrong... have you figured out the right formatting for that in these newer versions of MC and would you be willing to share that?

opstudio
join shbcf.ru