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;
@SylvKT
Copy link

SylvKT commented Mar 28, 2020

thank you. now i can do evil things

@Sanae6
Copy link

Sanae6 commented Jun 4, 2020

thank you. now i can do evil things

thank you. now i can do evil things

@theishiopian
Copy link

thank you. now i can do evil things

thank you. now i can do evil things

thank you. now i can do evil things

@ggtylerr
Copy link

ggtylerr commented Aug 1, 2020

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

@nea89o
Copy link

nea89o commented Sep 25, 2020

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

@SLimeyMC
Copy link

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

yes

@RubenVerg
Copy link

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

thank you. now i can do evil things

@RMuskovets
Copy link

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

thank you. now i can do evil things

thank you. now i can do evil things

@AlexR28
Copy link

AlexR28 commented Jan 12, 2021

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

thank you. now i can do evil things

thank you. now i can do evil things

thank you. now i can do evil things

@phillyfox
Copy link

phillyfox commented Jan 28, 2021

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
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

@ERN468
Copy link

ERN468 commented Apr 3, 2021

how do you access the FabricLootSupplier from the json?

@falkreon
Copy link
Author

falkreon commented May 2, 2021

how do you access the FabricLootSupplier from the json?

How do you mean, "from the json"?

This gist is specifically about responding to the LootTableLoadingCallback event that fabric fires when minecraft loads a loot table. What you get from the event is normally immutable, but the information provided here will allow you to make changes to it as it's being loaded.

@Mxz-Astatine
Copy link

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
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

@SylvKT
Copy link

SylvKT commented Jul 30, 2023

please stop spamming
it's filling up my mailbox

@nea89o
Copy link

nea89o commented Jul 31, 2023

please stop spamming it's filling up my mailbox

image

@ggtylerr
Copy link

please stop spamming it's filling up my mailbox

thank you. now i can do evil things

@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