Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.coloration.mod;
- import net.java.games.input.Component.Identifier;
- import net.minecraft.block.Block;
- public class ColorfulBlock extends Block {
- public ColorfulBlock(Block.Settings settings) {
- super(settings);
- @Override
- public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
- //EARLY DETECTION OF BUSTED LOOT TABLES:
- Identifier tableId = this.getDropTableId();
- System.out.println("Loot table ID is: "+tableId);
- if (tableId == LootTables.EMPTY) {
- return Collections.emptyList();
- } else {
- LootContext context = builder.put(LootContextParameters.BLOCK_STATE, state).build(LootContextTypes.BLOCK);
- ServerWorld world = context.getWorld();
- LootSupplier lootSupplier = world.getServer().getLootManager().getSupplier(tableId);
- List<ItemStack> result = lootSupplier.getDrops(context);
- if (result.isEmpty()) {
- //This might not be good. Confirm:
- if (lootSupplier instanceof FabricLootSupplier) {
- List<LootPool> pools = ((FabricLootSupplier)lootSupplier).getPools();
- if (pools.isEmpty()) {
- System.out.println("The loot pool json really is bad somehow!");
- }
- }
- }
- return result;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement