com.magistuarmory.misc.ModLoot Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of 1.20.2-epic-knights-common Show documentation
Show all versions of 1.20.2-epic-knights-common Show documentation
mod that adds medieval stuff to the game
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);
}
}