#(jah_coby) Chest loot replacement

1 messages · Page 1 of 1 (latest)

boreal halo
#

I was going to replace the loot for certain structures with loot generates event but I'm struggling with a good way to know what structure they are in. Area doesn't seem to cover structures nor could I find something similar for structures with my searches.

I thought to check using find_structure but when testing in singleplayer to find the ranges it can extend up to ~600 blocks for many chests, and thats a huge area to be replacing loot in. Anything I can do to better achieve this or at least narrow down the replacement?

obsidian zincBOT
#

(jah_coby) Chest loot replacement

obsidian zincBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

boreal halo
#

Actually, can I pull the table that is being used? I could check that way if so, although I'd need like, a chain of if checks or something to test multiple?.

hearty copperBOT
#
Possible Confusion

Did you mean to search for loot generates?

hearty copperBOT
# bronze lantern !e generates loot
Group

World

Event Lines

loot generates

Switches

for:<type> to only process the event if a certain inventory type is receiving loot (like 'for:chest').

Triggers

when loot is generated somewhere in the world (like a vanilla chest being opened for the first time).

Has Player

when the linked entity is a player. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<context.entity> returns an entity that caused loot generation, if any.
<context.inventory> returns the InventoryTag that loot is generating into.
<context.items> returns a ListTag of the items being generated.
<context.loot_table_id> returns an element indicating the minecraft key for the loot-table that was generated.

Determine

"LOOT:<ListTag(ItemTag)>" to change the list of items that will generate as loot.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

bronze lantern
#

Use the loot_table_id

boreal halo
# bronze lantern Use the `loot_table_id`

Ah cool, for the actual replacement then I should find out the table with an if chain to decide replacement or is there better practice for that?

I could be missing something related to making custom tables but seems like my options would be to replace with another vanilla table or clear the generation and run a task that act like a loot table

bronze lantern
#

An if works fine for a singular replacement, but I'd recommend a choose instead if you're doing multiples.

#

Of course, these only run once.

#

You can make your own loot table system for touched chests already too if you really wanted to, but obviously for untouched chests you'll want to modify them first.

boreal halo
#

ahh okay "choose" I figured there must have been something like that but couldn't find a name lol

bronze lantern
#

!c choose

hearty copperBOT
# bronze lantern !c choose
Group

queue

Syntax

choose [<option>] [<cases>]

Short Description

Chooses an option from the list of cases.

Description

Chooses an option from the list of cases.
Intended to replace a long chain of simplistic if/else if or complicated script path selection systems.
Simply input the selected option, and the system will automatically jump to the most relevant case input.
Cases are given as a sub-set of commands inside the current command (see Usage for samples).

Optionally, specify "default" in place of a case to give a result when all other cases fail to match.

Cases must be static text. They may not contain tag...

bronze lantern
#

I've done similar. I've re-written all of the loot tables myself personally, with weights, quantity of items, and other stuff for my own personal use.

boreal halo
#

While it only runs once it shouldn't matter if I then run a loot task for whichever choice it is? since the loot generates should trigger for every opening on its own and I don't think theres any reason to change the table multiple times on one chest

bronze lantern
#

There isn't, unless you're custom designing your own special dungeons with special regenerating loot. All you need to do is determine the items in that event.

boreal halo
bronze lantern
#

I don't think they do.

#

I almost wanna say it clears their loot table id.

#

!tias

hearty copperBOT
# bronze lantern !tias
Info: tias

Try it and see!

If somebody pulled this up for you, you're probably asking a question of the public channel that's easier and faster to figure out by just attempting your idea in-game and looking at the result of that attempt.

bronze lantern
#

!t locationtag.loot_table_id

hearty copperBOT
boreal halo
#

ah okay, if you don't mind could you point me to the general direction of running it for already touched chests? I realized I replied to wrong message there

bronze lantern
#

That's something you'll have to customize yourself.

boreal halo
#

Gotcha, when you'd mentioned wasn't sure if there was another handy feature I didn't know about for doing it

bronze lantern
#

I'm... Not actually sure if applying a loot table before they right click will re-generate it properly, or if it'll be too late. Let me give that a try.

boreal halo
bronze lantern
#

I may have a solution, let me check for regenerating loot.

boreal halo
#

I think the data would persist based on stuff I've seen done with vanilla commands

#

Oh awesome, I appreciate the extra info digging

#

The lazy and bad code part of me would think about running a task to "regen" loot that is just on a long ass timer after the loot generates replacement, buttt pretty sure in any given circumstance that would be a horrible way of doing it 😅

bronze lantern
#

Alright, so this totally does work.

#

When you generate loot, you can flag the location. I'd suggest maybe two flags or one flag with two values in it. One for the loot table id, one for when the loot was generated.

You can use on player right clicks block event to then re-apply the loot table id, and it'll generate that look after the event.

#

Obviously with the flags you can check the time from now versus when it was looted originally.

boreal halo
bronze lantern
boreal halo
jagged runeBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@boreal halo