Skip to content

Instantly share code, notes, and snippets.

@falkreon
Last active March 3, 2024 15:08
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save falkreon/0c5832de1938f885b43da233608ec716 to your computer and use it in GitHub Desktop.
Save falkreon/0c5832de1938f885b43da233608ec716 to your computer and use it in GitHub Desktop.
How to do Bad Things to Loot Pools

How to do Bad Things to Loot Pools

The Structure

LootSupplier {
	contextType: "block"
	
	pools: [
		LootPool
		LootPool
		LootPool
	]
	
	functions: [
		LootFunction
		LootFunction
	]
}

A "loot table json file" is a LootSupplier. And inside, they look sort of like this. If you're lucky enough to have fabric installed, you can grab all of this information from any supplier.

if (supplier instanceof FabricLootSupplier) {
	LootContextType contextType  = ((FabricLootSupplier)supplier).getType();
	List<LootPool> pools         = ((FabricLootSupplier)supplier).getPools();
	List<LootFunction> functions = ((FabricLootSupplier)supplier).getFunctions();
}

These can then be copied or modified, then poured back into a new LootSupplier

FabricLootSupplierBuilder replacement = FabricLootSupplierBuilder.builder();
replacement.withType(contextType);
for(LootPool pool : pools) {
	FabricLootPoolBuilder modifiablePool = FabricLootPoolBuilder.of(existingPool);
	// your Evil Stuff goes here
	replacement.withPool(modifiablePool);
}
replacement.withFunctions(functions); //Not a lot of fun Evil that can be done here.

We can then completely overwrite the FabricLootSupplierBuilder we've been given in our LootTableLoadingCallback

setter.set(replacement.create());
return;
@theishiopian
Copy link

please stop spamming it's filling up my mailbox

thank you. now i can do evil things

thank you, now I can do evil things

@SylvKT
Copy link

SylvKT commented Aug 14, 2023

please stop spamming it's filling up my mailbox

thank you. now i can do evil things

thank you. now i can do evil things

@ozi2285
Copy link

ozi2285 commented Oct 1, 2023

thank you. now i can do evil things

thank you. now i can do evil things

@SylvKT
Copy link

SylvKT commented Oct 15, 2023

please stop spamming it's filling up my mailbox

thank you. now i can do evil things

thank you. now i can do evil things

thank you. now i can do evil things

thank you. now i can do evil things.

@heckerpowered
Copy link

please stop spamming it's filling up my mailbox

thank you. now i can do evil things

thank you. now i can do evil things

thank you. now i can do evil things

thank you. now i can do evil things.

thank you. now i can do evil things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment