Fabric Modding Tutorial - Minecraft 1.20: Custom Loot Tables | #5
Summary
TLDRThis video tutorial covers how to add custom loot tables to blocks in a Minecraft mod. Loot tables dictate what items drop when blocks are broken, or when chests or entities are interacted with. The tutorial guides you through setting up JSON files for loot tables, managing conditions like block destruction from explosions, and tagging blocks for tool requirements. It also covers ore block settings, including experience drops, and ensures blocks are minable with the appropriate tools. The video concludes with in-game testing of the custom loot and ore blocks.
Takeaways
- 🔨 The tutorial focuses on adding custom loot tables to Minecraft modding, which determine item drops from blocks or entities.
- 📂 A new directory structure is created for loot tables, including 'loot_tables' and 'blocks' folders within the mod's data directory.
- 📝 Loot tables are defined in JSON files, specifying the type, pools, bonus rolls, conditions, and entries for item drops.
- 💥 A condition 'survives_explosion' is used to ensure blocks drop when exploded, demonstrating the versatility of conditions in loot tables.
- 🛠️ The 'requires_tool' setting on blocks affects loot drops, requiring specific tools to mine blocks and receive drops.
- 🏷️ Blocks are added to 'minable' tags to define mining capabilities with different tools, such as pickaxes, axes, shovels, and hoes.
- 🛡️ Higher tier tool tags like 'needs_iron_tool' and 'needs_diamond_tool' are used to set mining requirements for blocks.
- 🌌 The tutorial covers creating experience dropping ores, adjusting block strength, and setting experience drop rates.
- 📈 The process of balancing loot tables is discussed, including adjusting drop rates and experience values for custom ores.
- 🔗 External resources like the Minecraft loot table Wiki and loot table generators are recommended for further understanding and ease of creation.
Q & A
What is the primary purpose of loot tables in Minecraft modding?
-Loot tables in Minecraft modding determine what items are dropped when a block is destroyed or what items are contained within chests in certain structures, as well as what different entities drop.
How do you create a loot table for a custom block in Minecraft?
-To create a loot table for a custom block, you need to create a JSON file within the 'data/<modid>/loot_tables/blocks' directory, with the file name matching the block's name. The file specifies the items and conditions for the block to drop.
What are the steps to ensure a custom block drops items in Minecraft?
-To ensure a custom block drops items, you must add the loot table to the block, and then add the block to a specific tag that determines whether it can be mined with a pickaxe, axe, shovel, or hoe.
Why is it necessary to add a custom block to a tag in Minecraft modding?
-Adding a custom block to a tag is necessary to define the mining tool requirements and the conditions under which the block will drop items, such as whether it requires a specific tool tier or can be mined without a tool.
What is the 'needs_tool_level' tag used for in Minecraft modding?
-The 'needs_tool_level' tag is used to specify the minimum tool tier required to mine a block. It ensures that the block will only drop items if the correct tier of tool is used.
How can you make a block only mineable with a specific tool tier in Minecraft?
-To make a block only mineable with a specific tool tier, you add the block to a 'needs_tool_level' tag corresponding to that tool tier, such as 'needs_iron_tool' for iron tier tools.
What is the difference between 'minable' and 'needs_tool_level' tags in Minecraft modding?
-The 'minable' tag determines if a block can be mined with basic tools like a pickaxe, while the 'needs_tool_level' tag specifies the minimum tool tier required to mine the block.
How do you duplicate a loot table for multiple custom blocks in Minecraft?
-You can duplicate a loot table for multiple custom blocks by copying the existing JSON file and renaming it for each block, then adjusting the block names and any specific values within the JSON file for each block.
What is the role of the 'experience_dropping' block in Minecraft modding?
-The 'experience_dropping' block in Minecraft modding is used to define how much experience is dropped when the block is mined, allowing for customization of the experience gain.
How can you customize the amount of experience dropped by a block in Minecraft?
-You can customize the amount of experience dropped by a block by using the 'experience_dropping' block type and specifying a 'uniformintprovider' with the desired minimum and maximum values for the experience range.
Outlines
💾 Introduction to Custom Loot Tables in Minecraft Modding
This paragraph introduces the concept of adding custom loot tables to Minecraft blocks through modding. Loot tables determine what items are dropped when blocks are destroyed or what items can be found in chests within certain structures. The tutorial aims to add custom loot tables to a mod's blocks and then add these blocks to specific tags to control their behavior when mined. The process involves creating a 'loot_tables' directory with a 'blocks' subdirectory and naming the JSON files according to the block names in the mod's 'modblocks' class. The JSON file for a 'Ruby_block' is outlined, which includes a loot table type, pools, conditions, and entries that define the item to be dropped. The importance of matching the JSON file name to the block name in the mod is emphasized.
🛠️ Setting Up Loot Tables and Tags for Block Mining
The second paragraph delves into the specifics of setting up loot tables for ores and the necessity of adding blocks to mining tags. It explains how to create JSON files for different mining tools such as pickaxe, shovel, and axe, and how to specify the mining requirements for each block using tags like 'needs_iron_tool' and 'needs_diamond_tool'. The tutorial demonstrates how to adjust the mining requirements for different block types, such as making a block only mineable with an iron pickaxe or a stone pickaxe. The paragraph also covers how to create directories for tags and the importance of placing the correct JSON files in the appropriate directories to define the mining capabilities and requirements for the custom blocks.
🔩 Advanced Loot Table Configuration and In-Game Testing
This paragraph focuses on the advanced configuration of loot tables for ore blocks and the in-game testing of the custom blocks' mining and dropping behavior. It discusses creating new ore blocks with specific mining times and experience drop rates, and how to duplicate and modify existing block settings for different types of ores. The tutorial also covers how to add these ore blocks to the creative mode tab and to the appropriate mining tags, such as 'needs_diamond_tool' for blocks that require a diamond pickaxe to drop items. The paragraph concludes with a demonstration of the in-game functionality, showing the correct dropping of items and experience when the custom blocks are mined with the appropriate tools.
🎮 Conclusion and Preview of Future Tutorials
The final paragraph wraps up the tutorial by summarizing the achievements, which include successfully setting up custom loot tables and tags for mining custom blocks in Minecraft. It highlights the successful in-game testing of the ore blocks, which now drop raw materials and experience as intended. The paragraph ends with a teaser for the next tutorial, which promises to cover advanced item creation, suggesting that the series will continue to explore more complex aspects of Minecraft modding.
Mindmap
Keywords
💡Loot tables
💡Custom blocks
💡Conditions
💡Tags
💡Fabric modding
💡Json files
💡Minable tag
💡Experience dropping blocks
💡Ore blocks
💡Tool level
Highlights
Introduction to adding custom loot tables in Minecraft modding.
Explanation of loot tables determining drops from blocks or entities.
Tutorial on creating a loot table for custom blocks.
Step-by-step guide to naming and structuring loot table folders and files.
Details on defining loot table entries and conditions.
Example of a condition that makes a block drop when exploded.
Recommendation to use loot table resources for reference.
Process of adding blocks to mining tags for tool requirements.
Demonstration of creating JSON files for tool tags.
Explanation of how to make blocks only mineable with specific tool tiers.
In-game testing of block drops with different tools.
Discussion on creating custom ore blocks with experience drop mechanics.
Guide to adjusting block strength and experience drop rates for ores.
Instructions for adding custom ores to mining tags.
Tips for creating loot tables for ores with specific drop conditions.
Final in-game demonstration of custom ore blocks dropping items.
Conclusion and预告 of the next tutorial on advanced item mechanics.
Transcripts
let's add drops to our blocks with loot
tables
Minecraft modding courses with close to
100 topics ranging from Custom tools and
armor to custom block entities all the
way to custom mobs Linked In the
description below oh really fences back
until everyone's more and in this
tutorial we're gonna be adding a custom
loot tables to Minecraft and our mod and
loot tables basically determine what is
going to be dropped for example when you
destroy a block or they can also
determine other things like what types
of items are going to be inside of luge
chests right in certain structures what
different entities drop all of those
things governed by loot tables and in
this tutorial we're first of all going
to add the loot table to our custom
blocks and then there's a second part of
this tutorial where we'll actually have
to also add our blocks to a certain tag
in order for the blocks to actually drop
something but one step after the other
first of all you need tutorial mode data
folder we can right click new directory
called loot underscore tables make sure
that this is written correctly loot
underscore tables exactly like this
nothing else and inside of that folder
another folder called blocks please make
sure that this is done correctly I've
seen Every Which Way that this has been
written wrong it has to be data folder
tutorial mode or your mod ID load
underscore tables and then blocks and
then here in this case the name of the
Json file actually once again has to
match the name given right here in the
modblocks class so Ruby underscore block
and raw Ruby underscore block let's
start with the Ruby blocks let's create
a new file over here Ruby underscore
block dot Json here in this case there
you go and once again I will just type
out the contents here and then we'll go
through and see what all of this
craziness is so first of all this is of
course once again a type and the type
here is a Minecraft colon block because
this is a block loot table we then
Define some pools so pools is once again
a list here in this case or an array and
in this case we will only Define one
pool and the pool has zero bonus rules
bonus rolls of zero and then conditions
are going to be a standard condition and
that is going to be condition Minecraft
colon survives
underscore explosion after the list of
the conditions you then Define entries
in this case we have an entries list
over here we're going to have a one
entry that is going to be of type
Minecraft
colon item and the name of this item is
going to be tutorial mod colon Ruby
underscore block
and this whole thing is done with the
number of rolls of one awesome the first
question you might ask is what the frick
is this condition well the condition
basically just means that the Ruby block
will also fall when an explosion
destroys this block should be fairly
self-explanatory and what is going to
drop is exactly what we Define in this
entry over here and that's the Ruby
block I highly recommend checking out
either the loot table fandom Wiki
article over here or the loot table
generator for misode which is going to
be very useful indeed as long as we
don't have the data generation that's
going to make the loot tables about a
million times easier those basically
tell you a bunch of stuff that the loot
tables can contain and what everything
means I will link those in the
description below but just like the
recipes of course give access to all of
the loot tables in the external
libraries which is going to go down all
the way here to the Minecraft merge
project and we will look in the data
folder Minecraft loot tables we are
going to go into the blocks folder and
here we go every single loot table for
every single block that exists in
Minecraft it couldn't be easier how to
Planck's drop well I mean they literally
drop exactly the same way as the Ruby
over here they just drop themselves
right so most of this stuff is going to
look very similar the only things that
might look a little bit different are
ore blocks let's cover first of all the
raw Ruby block for this we're just going
to drag the same adjacent file into the
same folder while holding Ctrl and we're
just going to rename this to Raw Ruby
block and similar here this is just the
raw Ruby block as of right now your
blocks will still not drop something
because they have the block setting
inherited from the iron block that is
called requires tool and if requires
tool is called on your particular block
that means that it can only be mined or
it only will drop something if the
correct tool is going to be used for
this and for that you need to add this
to a tag now in the highest level
overview tags are simply collections of
blocks items or sometimes some other
things that have a similar purpose and
in our case we need to add our blocks to
a minable tag that's going to determine
whether or not it can be mined with a
pickaxe an ax a shovel or a hoe and we
can also add it to a needs extrude tag
which basically determines whether or
not it has to have a certain tier of
tool to be minable this happens in the
data folder again but this time instead
of the Minecraft directory inside they
will make a new directory called Tags
and inside of there once again we want
to make a new directory called blocks
and lastly we also want to make another
new directory called minable now in the
mindable folder we'll create four Json
files this is going to be the ax.json
I'll already put the Json file contents
in here so you can see a Json file is
very very straightforward it's just the
curly brackets then a replace faults and
then a list of values this time it's
empty because I just wanted to copy over
this Json file for all the other tags
that we need because it's quite a few
actually so when you have this you can
of course also take a look at all the
Json files in the description below in
the GitHub repository and what you can
do is we can just drag this into the
same folder and we can call this the
pickaxe.json and then we can drag this
into the same folder again once again
while holding Ctrl we can call this the
shovel and then lastly the whole and
then there's extremely important the
other ones traded in the locks folder
not the minable folder so we drag this
into the blocks folder this time I'm
going to call this the needs underscore
iron underscore tool and then once again
dragging this into the blocks folder
needs Diamond Tool and this actually
also needs
Stone tool so those are the different
levels if you want to require nether
right or higher what you have to do is
you have to do this in another folder is
a little annoying but it is what it is
so in the data folder right click new
directory called Fabric and then inside
of there we want to make a new directory
called Tags and then another new
directory called the blocks and then
inside there we can make the following
Json file and that's the needs
underscore tool underscore level
underscore 4. and the needs underscore
tool underscore level underscore for
Json file under the fabric folder here
that's quite important that one
basically allows you to make your block
only minable with netherrite let's start
with the pickaxe Json because in our
case well obviously the Ruby block in
the Raw Ruby block should only be
minable with a pickaxe here so we're
going to add those tutorial mod colon
Ruby underscore block and then similarly
the second one is just going to be the
raw Ruby block there we go in this case
if we leave it like this now our Ruby
block and our raw Ruby block can be
mined with any pickaxe including it will
wooden pickaxe if we then say you know
what I actually want my raw Ruby block
to only be mineable with an iron pickaxe
then we just add it right here and then
for example maybe we say you know what
and then I only want my Ruby block to be
minable with a stone pickaxe let's say
there we go now this is going to be done
do keep in mind that when you have the
need Stone tool for example your Ruby
block now would also be minable with
iron diamond and netherride and anything
above it so it always is basically this
particular two level or higher I do not
believe there is an easy way to make
this function a different way just keep
that in mind and with this way the Ruby
Rock and the raw Ruby block given the
correct tools will now drop something
and we'll actually take a look at this
and then we'll take a look at the ores
as well but first of all let's go into
the game and see our blocks drop
something all right fine stuff in
Minecraft and I've prepared all of our
blocks over here and I've also prepared
well some of my pickaxes so in this case
neither the Ruby block nor the raw Ruby
block should be mindable with a well
normal pickaxe here in this case a
wooden pickaxe and you can see it
already takes a really long time and
there's a very good indication that this
is probably not going to work but we'll
just let this run through and there we
go nothing dropped if I use a stone
pickaxe however let's see this is a
little bit faster and there we go a Ruby
block drop awesome now the raw Ruby we
defined only being able to be mindable
with a iron pickaxe so if we use Stone
right here it is okay in terms of speed
but you will see it is not going to drop
anything
there we go got nothing however with an
iron pickaxe it is going to drop awesome
and of course also with an ax this does
not work you can see it is already
taking way too long like you would
probably never do this similar with this
one right here even with the never light
ax doesn't work however higher tiers
such as Diamond that works totally fine
and then similar netherride also works
totally fine for all of our blocks here
as I've said the tools here that you
define is always the one that it needs
or higher than that and now let's also
take a look at some ore so for this I
will be copying over four different
blocks that we're going to need and what
I mean by copying over is I'm going to
create one of them and then the other
three I'm just going to well basically
copy over all of the code is of course
available to you in the description
below so no worries at all so you should
be totally fine all right so to add ore
we're just going to do a public static
final and there's going to be a block
once again this is going to be the Ruby
underscore or this will be equal to the
register block method I'm going to call
this the Ruby underscore or right here
now instead of a new block this is going
to be a new experience dropping block
here in this case and the first
parameter of which is just going to be
fabric block settings dot copy of and
we're going to copy block start Stone we
can then also Define the strength over
here this is just going to be how long
it's going to take to actually break
this particular Block in this case so
maybe we want this to be you know taking
a little bit longer than stone stone for
reference over here we can take a look
at this has a strength of 1.5 so maybe
we say that this has a strength of two
and then after the first closing
parenthesis after the strength over here
we then also wanted to add a uniformind
provider dot create and this is going to
determine how much experience this block
will drop when you actually destroy it
so for example we're just going to
choose between two and five over here
ended with a semicolon here at the end
and then your Ruby or has been created
to double check the vanilla values of
the ore blocks just middle Mouse one
click on the experience dropping block
over here middle Mouse one click here
again and in the blocks class you will
be able to find lapis for example or
Diamond let's just take a look at lapis
at the very end over here we'll be able
to find that lapis drops between 2 and 5
as well and we can take a look at the
other ore blocks as well so for example
emerald ore that's going to be in 628 in
see that one drops between three and
seven the numbers those are always
things that you have to take a look at
yourself and basically change in
whatever which way you like to balance
your mod properly but that's going to be
a good idea here for the moment I don't
want to end with Ruby or no no I want to
duplicate this four times so just select
it press Ctrl D to duplicate and I also
want the Deep slate Ruby ore of course
very important that we change the name
right here if you do not change the name
inside of the register block method that
you give it then we will run into an
error and the actual game will not start
here we of course want to copy the
blocks.deep slate in order to get the
Deep slight sounds
and the strength might be 4 because it's
a little bit hard we are also going to
get the nether Ruby ore this is going to
be the nether Ruby ore there we go
and this is of course going to copy well
Netherrack and maybe this is actually a
little bit of a lesser strength because
Netherrack is not really that strong
and then lastly we have end we have end
stone ruby ore and of course changing
the name here as well and stone ruby ore
and this is going to be copying the end
stone block
and here once again maybe with a little
bit more strength because why not you
can of course also play around with the
in providers over here so for example oh
the end or that's going to give you way
more experience because the wall is way
crazier and way more harder way harder
to get to the end to actually mine this
ore so there you go that could be one of
the reasons why you would do that there
we go I've added all of the oars to the
creative mode tab this really shouldn't
be anything crazy let's just add the
translation all of this should be fairly
self-explanatory at the end of the day
it literally is just changing the name
right here and then changing whatever
the translation is it should be pretty
trivial at this point then of course now
to have the blocks properly added yes we
do need to add all of the Json files
that is a little bit of annoying thing
but like I said just give it a few more
tutorials and then we're going to add
this in record speed yes in this case we
do need to copy them over now I'm going
to cheat and I have already prepared
them and I'm just going to copy them
over like this but you can see the
contents of them are literally exactly
the same compared to the Ruby block and
the raw Ruby block so really it
shouldn't be any issue at all and of
course the contents you can always take
a look at those in the GitHub repository
as well alright the textures here as
well and those are of course always
going to be available to you for
download in the description below and
now to the interesting thing and that is
adding all of them to the tags so of
course we can just add all of them to
the pickaxe tag because all of those
four ores would be minable with the
pickaxe so there we go basically just
add it to the pickaxe Json file and now
let's just play around with this a
little bit so let's for example say that
the End Stone can only be mined with
netherrite here so we're going to add
this to the neat underscore tool
underscore level underscore for Json
file in the data fabric tags blocks
folder over here very important and we
will be able to see that we can only
ever mine this with a netherride pickaxe
or higher if we add custom levels and
see that in a future tutorial as well
and then let's say for example that the
Deep State can only be mined with
diamond here for example and now while
they can be mined well they won't drop
anything yet because we still haven't
added the loot tables so you can see
there is a little bit of a process over
here but like I said once we go through
this once you understand you have to
understand sort of what the process is
right what are loot tables what are they
good for what are tags what are they
good for what do they do especially the
minable and the he needs you know X tool
tag after you've understood what all of
those do then we're going to be able to
make them way easier with datagen but
for the time being it's a little bit
more of an involved process and for the
ore blocks what I recommend is you go to
the external libraries once again down
to the emerge project over here to data
loot tables blocks and you just take a
look at for example the copper ore one
now this one will actually shock you I'm
gonna open this and you're gonna be like
oh my Lord what is all of this craziness
absolutely not to worry we're just going
to copy this over so select it press
Ctrl C to copy it and then Ctrl V
pasting it into the correct folder over
here I'm going to rename this to the
Ruby or and then we just need to make
sure that we change everything in the
correct places so for example here where
it drops the copper ore when we use silk
touch we want it to drop tutorial mode
colon Ruby underscore or and then down
here instead of raw copper we wanted to
drop raw Ruby of course making sure we
also change Minecraft over here to
tutorial mode this is extremely
important and then down here we're just
going to call this the tutorial mode
blocks Ruby orb awesome and now we can
just duplicate this a couple of times
this is going to be the Deep slate
underscore Ruby ore and then there's
going to be the Deep slate Ruby ore and
for the raw Ruby that's still going to
drop and then here you can of course see
this is a uniform distribution so it
will drop between two and five you can
of course change this you know so for
example you might say oh for the website
it should drop between three and six
something like that you can always of
course change the numbers highly
recommended to try this out and and just
play around with this a little bit
alright and just for the sake of
argument I've also added the Nether and
the end stone ruby or block loot tables
once again you can take a look at those
in the GitHub repository and now we can
go into the game we can see our ore and
we can see them drop something when we
mine them alright here we are in
Minecraft and let's just try and mine
our ores and you can see there we go so
that works no worries at all diamond
pickaxe or the Deep slight also works
for the nether also works but here it
should not work because the N Stone
should only be minable exactly with
netherrite and let's take a look and
then we go so absolutely Works no
worries at all absolutely amazing we got
our ore drops they drop our raw Ruby
they drop experience absolutely freaking
fantastic right that's gonna be it for
this tutorial right here next time we're
gonna do an advanced item very cool
stuff take a look at it here and I hope
to see you there so yeah
Посмотреть больше похожих видео
Structures with Loot Chests (Mcreator 2022.1)
Fabric Modding Tutorial - Minecraft 1.20: Advanced Item | #6
The Best Order Block for Entering Profitable Trades in Smart Money trading technique.
بيت الفقير ضد بيت الغني لعبة roblox !! 💩🤑
Hostile Neural Networks Tutorial and Automation | All The Mods 7 EPISODE 13
Minecraft Unlocked: The Ultimate Apotheosis Gem Guide
5.0 / 5 (0 votes)