Arqade Asked on June 4, 2021
I am essentially looking for a way to do three things related to when a block is broken:
a) Change a block’s "loot table" (what the block drops), either single or multiple item/block drops
b) (if possible) create multiple separate loot tables for a block (essentially meaning one of these loot tables is randomly picked every time the targeted block is broken)
c) Detect when the block is broken, and then create a structure at the location where the block is broken
For an example, what I’m trying to do is basically a simplified lucky block (if you are not familiar with the term "lucky blocks" or their functionality, when a lucky block is broken, it will drop a random item (in some cases, also multiple items), but also will sometimes cause structures to be generated (these structures are generated at the point where the block is broken.)
As for "changing a block’s loot table" (I’ll refer to each as a point – point a, point b, etc.), I’m assuming that I will have to essentially change a loot table for a certain block (although I haven’t found much information on how to do so or if block loot tables exist)
For point b, a datapack could probably get involved, but a solution that requires physical command blocks and a redstone circuit would very much work as well. (maybe some sort of repeating command block that detects when any block of a certain type – such as podzol, sponges, etc. – is broken, and then somehow randomly picks an "event" (I’m thinking a command block that takes the coords of where the block was located and then summons the items or structure in question) and then executes it.)
For point c, I honestly think the only way that would be possible would be through the usage of structure blocks and loading in the structures (I would be perfectly fine with this), although I don’t know how command blocks can place and then automatically load the structures in without needing the player to manually load it in themselves.
I will take any solution, although they’ll need to adhere to just three requirements:
1.14+ only (Since I’m doing this on a 1.14 world, 1.14+ would be recommended but if the formatting is the exact same in 1.13, then I can take 1.13 too. Essentially 1.14-1.16 only, but 1.13 if it functions the same in newer versions. If I’m desperate, then I will take at most 1.12-1.16)
Vanilla only/preferred (it would be best if the solution wouldn’t require mods, as I would prefer not to mess around with mods on my world/in general)
Java Edition only (I have tagged the question as "java-edition", but just in case, please don’t submit answers for other versions of Minecraft!)
I only need this to work in a relatively moderately-sized region (about 20 chunks or so), so any redstone contraptions or command blocks probably will be kept loaded while in the area (most/all solutions will probably work).
If only 2 or even 1 of the "points" can be done, I’ll still be grateful for at least a partial solution, and anything helps.
(Note: I have tagged the question as "minecraft-redstone", "minecraft-data-packs", and "minecraft-commands", but if they are unrelated/are not part of the answer, then please remove those tags. Also, if the title is not specific enough/not good enough, then change it as well. Thank you.)
Your question 1 and 2 are basically just this one. Please only ask one question per question.
The answer to your third question is a bit difficult, because unlike for placing blocks, there is no advancement trigger for breaking blocks. It's suggested here (archive).
So either you could just make your lucky blocks automatically trigger when placed (then an example datapack that does something like this is here) or you could check for increments of a scoreboard of e.g. the mined:stone
type and then use raytracing to find the ground behind the broken block. That's of course not the best way to do it, so you can get a lot more precise, but also more resource-intensive by checking which block a player looks at every tick and then execute at that position when the mined:stone
scoreboard changes.
Correct answer by Fabian Röling on June 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP