All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.magistuarmory.misc.ModLoot Maven / Gradle / Ivy

There is a newer version: 8.10
Show newest version
package com.magistuarmory.misc;


import com.magistuarmory.EpicKnights;
import com.magistuarmory.block.ModBlocks;
import dev.architectury.event.events.common.LootEvent;
import net.minecraft.class_2960;
import net.minecraft.class_55;
import net.minecraft.class_79;
import net.minecraft.class_83;

public class ModLoot
{
    public static void modifyLootTable(class_2960 id, LootEvent.LootTableModificationContext context) 
    {
        String prefix = "minecraft:chests/";
        String name = id.toString();

        if (name.startsWith(prefix)) 
        {
            String file = name.substring(name.indexOf(prefix) + prefix.length());
            switch (file) {
                case "desert_pyramid", "end_city_treasure", "jungle_temple", "nether_bridge", "ruined_portal", "simple_dungeon", "stronghold_corridor", "village/village_weaponsmith" ->
                        context.addPool(getPool(file));
                default -> {}
            }
        }
    }

    public static class_55 getPool(String entryName) 
    {
        return class_55.method_347().method_351(getPoolEntry(entryName)).method_355();
    }

    @SuppressWarnings("rawtypes")
    private static class_79.class_80 getPoolEntry(String name) 
    {
        class_2960 table = new class_2960(EpicKnights.ID, "chests/" + name);
        return class_83.method_428(table);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy