Fabric Modding Tutorial - Minecraft 1.20: Custom Loot Tables | #5
Summary
TLDRIn diesem Tutorial wird gezeigt, wie man benutzerdefinierte Beutetabellen zu Minecraft und einem Mod hinzufügt. Beutetabellen bestimmen, welche Gegenstände fallen, wenn man Blöcke zerstört oder bestimmen, welche Gegenstände in Truhen in bestimmten Strukturen enthalten sind. Es wird gezeigt, wie man Beutetabellen für benutzerdefinierte Blöcke erstellt und diese Blöcke zu Tags hinzufügt, um festzulegen, welche Werkzeuge benötigt werden, um sie abbauen zu können. Zusätzlich wird das Hinzufügen von Erzblöcken und deren Beutetabellen behandelt, einschließlich der Anpassung der Erfahrungspunkte, die fallen, wenn sie zerstört werden.
Takeaways
- 😀 Die Loot-Tabellen in Minecraft bestimmen, was fallen gelassen wird, wenn man einen Block zerstört oder bestimmte Items in Truhen in bestimmten Strukturen findet.
- 🔨 Um benutzerdefinierte Loot-Tabellen hinzuzufügen, müssen Verzeichnisse wie 'data/<Mod-ID>/loot_tables/blocks' erstellt und entsprechende JSON-Dateien erstellt werden.
- 📂 Die JSON-Dateien für Loot-Tabellen müssen den Namen der Block-Klasse entsprechen und enthalten Informationen wie Typ, Pools, Bedingungen und Einträge.
- 💥 Eine Bedingung wie 'Minecraft:survives_explosion' sorgt dafür, dass der Block auch bei einer Explosion fallen gelassen wird.
- 🛠 Loot-Tabellen können auch festlegen, welche Werkzeuge benötigt werden, um einen Block abbauen zu können, indem sie Tags wie 'needs_tool' verwenden.
- ⚒ Die Tags 'minable' und 'needs_<tool>_tool' sind wichtig, um festzulegen, mit welchen Werkzeugen ein Block abgebaut werden kann.
- 💎 Die Stärke und Erfahrungspunkte eines Blocks können durch die Verwendung von 'experience_dropping_block' und Einstellungen für die Stärke und 'uniformIntProvider' angepasst werden.
- 📝 Die Übersetzung und Textur der neuen Blöcke müssen ebenfalls aktualisiert werden, um sie im Spiel korrekt anzeigen zu lassen.
- 🔗 Es wird empfohlen, die Loot-Tabellen der originalen Minecraft-Blöcke zu überprüfen, um die richtigen Werte für die eigenen Mods zu ermitteln.
- 🔄 Der Prozess der Erstellung von Loot-Tabellen und Tags kann etwas umständlich sein, aber es gibt Tools und externe Bibliotheken, die dies später vereinfachen können.
Q & A
Was ist das Hauptthema des Video-Tutorials?
-Das Hauptthema des Video-Tutorials ist das Hinzufügen von benutzerdefinierten Beutetabellen zu Minecraft und einem eigenen Mod.
Was bestimmen Beutetabellen in Minecraft?
-Beutetabellen bestimmen, welche Gegenstände fallen, wenn man Blöcke zerstört oder bestimmte Strukturen öffnet, sowie welche Gegenstände in Truhen in bestimmten Strukturen enthalten sind.
Wie wird eine neue Beutetabelle für einen benutzerdefinierten Block erstellt?
-Zunächst muss ein neues Verzeichnis namens 'loot_tables' erstellt werden, gefolgt von einem Unterverzeichnis namens 'blocks'. Dort wird eine JSON-Datei mit dem Namen des Blocks erstellt, die die Beutetabelle definiert.
Was ist ein 'Pool' in Bezug auf Beutetabellen?
-Ein 'Pool' ist eine Liste oder ein Array, das definiert, welche Gegenstände in der Beute fallen können. In dem Tutorial wird ein einzelner Pool mit null Bonuswürfeln und einer Bedingung definiert.
Wie wird sichergestellt, dass ein Block bei einer Explosion fällt?
-Durch die Definition einer Bedingung 'Minecraft:survives_explosion' in der Beutetabelle, wird sichergestellt, dass der Block auch bei einer Explosion fällt.
Warum müssen Blockdefinitionen in bestimmten Tags hinzugefügt werden?
-Blockdefinitionen müssen zu Tags hinzugefügt werden, um festzulegen, ob sie mit bestimmten Werkzeugen gezielt werden können, wie zum Beispiel mit einer Axt, einem Spaten oder einer Schaufel.
Was bedeuten die Tags 'minable' und 'needs_tool_level'?
-Der Tag 'minable' bestimmt, ob ein Block mit einer bestimmten Werkzeugkategorie abgebaut werden kann, während 'needs_tool_level' festlegt, welcher Mindestwerkzeuglevel benötigt wird, um den Block abbauen zu können.
Wie wird der Erfahrungswert eines Blocks festgelegt?
-Der Erfahrungswert wird durch den 'experience_provider' in der Blockdefinition festgelegt, wobei ein zufälliger Bereich von Erfahrungswerten definiert wird, der beim Abbau fallen kann.
Wie kann man die Stärke eines Erzblocks im Vergleich zu anderen Erzen anpassen?
-Die Stärke eines Erzblocks wird in der Blockdefinition festgelegt und kann durch Anpassen des 'strength'-Parameters im Vergleich zu anderen Erzen wie Stein oder Netherrack angepasst werden.
Wo kann man Beispiele für vorhandene Beutetabellen in Minecraft finden?
-Beispiele für vorhandene Beutetabellen in Minecraft können im 'Minecraft'-Verzeichnis der externen Bibliotheken unter 'data/loot_tables/blocks' gefunden werden.
Outlines
💾 Hinzufügen von Beutetabellen zu Minecraft-Mods
In diesem Tutorial wird gezeigt, wie man benutzerdefinierte Beutetabellen zu Minecraft und einer Mod hinzufügt. Beutetabellen bestimmen, welche Gegenstände fallen, wenn man Blöcke zerstört oder bestimmte Strukturen öffnet. Es wird erklärt, wie man eine Loot-Tabelle für benutzerdefinierte Blöcke erstellt und diese in einer Tag-Datei einfügt, um das Fallen von Gegenständen zu ermöglichen. Es wird auch gezeigt, wie man die Notwendigkeit einer bestimmten Werkzeugstufe für das Abbrechen der Blöcke festlegt.
🛠 Anpassen der Abbrechbarkeit von Blöcken mit Tags
Dieser Abschnitt behandelt, wie man Blöcke mit Tags versehen kann, um zu bestimmen, welche Werkzeuge benötigt werden, um sie zu zerstören und welche Gegenstände fallen. Es wird gezeigt, wie man Json-Dateien erstellt und welche Einstellungen man für die verschiedenen Werkzeugstufen (wie Eisen- oder Diamantwerkzeug) vorgenommen werden muss, um das Abbrechen und Fallen der Blöcke zu steuern.
🌐 Erstellen und Anpassen von Erzblöcken in Minecraft-Mods
In diesem Teil des Tutorials wird beschrieben, wie man Erzblock-Typen in einer Minecraft-Mod hinzufügt und anpasst. Es wird erklärt, wie man die Stärke und den Erfahrungswert der Blöcke einstellt und wie man die Beutetabellen für diese Blöcke erstellt, um das Fallen von Rohstoffen und Erfahrung zu steuern. Es wird auch gezeigt, wie man die Blöcke in die entsprechenden Tags einfügt, um ihre Abbrechbarkeit mit bestimmten Werkzeugen zu ermöglichen.
🎮 Testen der neuen Blöcke im Minecraft-Spiel
Schließlich wird im Spiel gezeigt, wie die neuen Blöcke und ihre Beutetabellen funktionieren. Es wird demonstriert, dass die Blöcke nur mit den richtigen Werkzeugen abgebaut werden können und wie sie die festgelegten Rohstoffe und Erfahrungswerte fallen. Dies zeigt, dass die vorherigen Schritte zum Erstellen und Konfigurieren der Beutetabellen und Tags erfolgreich waren und die Blöcke wie erwartet im Spiel funktionieren.
Mindmap
Keywords
💡Loot Tables
💡Minecraft Modding
💡Custom Blocks
💡Tags
💡Data Generation
💡JSON Files
💡Tool Requirements
💡Explosion Survival
💡Ore Blocks
💡Experience Drops
Highlights
Adding custom loot tables to Minecraft modding to determine block drops and chest contents.
Creating a loot table folder structure within the mod's data directory.
Naming conventions for loot table JSON files must match the block class names.
Defining loot table entries and conditions for block drops.
Using 'survives_explosion' condition for blocks to drop during explosions.
Tutorial mode data access for loot tables in external libraries.
Linking to loot table resources like the Fandom Wiki and loot table generator.
Modifying block settings to enable block drops with specific tools.
Creating tags for blocks to determine minability with different tools.
Adding custom blocks to 'minable' and 'needs_tool' tags for tool-specific drops.
Explanation of how to require specific tool tiers to mine blocks.
In-game testing of block drops with various pickaxe tiers.
Creating experience dropping blocks with custom break times and experience values.
Duplicating and renaming blocks for different ore types within the mod.
Adjusting block strength and experience drop values for balance.
Adding custom ore blocks to the creative mode tab for testing.
Copying and modifying vanilla Minecraft loot tables for custom ores.
Final in-game demonstration of custom ore blocks dropping specified items.
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
Weitere ähnliche Videos ansehen
Crashkurs für Anfänger | Canva Tutorial Deutsch
question tags - einfach erklärt | Einfach Englisch
Create First Person Animations in Unreal Engine 5! (TUTORIAL)
06 Wie lege ich einen Auszubildenden an
GAUß ALGORITHMUS einfach erklärt – lineare Gleichungssysteme lösen
How to Create Viral Product Videos Using AI
5.0 / 5 (0 votes)