forked from MobiusFlip/CrimsonRevelations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Rework how loot is injected into the existing cultist loot table. Remove the additional loot table used for the old method -The maximum amount of fabric and plates that can be obtained is 3 regardless of Looting enchantment level
- Loading branch information
1 parent
86768b9
commit e67cfbe
Showing
2 changed files
with
28 additions
and
68 deletions.
There are no files selected for viewing
34 changes: 28 additions & 6 deletions
34
src/main/java/mod/icarus/crimsonrevelations/init/LootTableHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,49 @@ | ||
package mod.icarus.crimsonrevelations.init; | ||
|
||
import mod.icarus.crimsonrevelations.CrimsonRevelations; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraft.world.storage.loot.LootTable; | ||
import net.minecraft.world.storage.loot.LootEntry; | ||
import net.minecraft.world.storage.loot.LootEntryItem; | ||
import net.minecraft.world.storage.loot.LootPool; | ||
import net.minecraft.world.storage.loot.RandomValueRange; | ||
import net.minecraft.world.storage.loot.conditions.KilledByPlayer; | ||
import net.minecraft.world.storage.loot.conditions.LootCondition; | ||
import net.minecraft.world.storage.loot.functions.LootFunction; | ||
import net.minecraft.world.storage.loot.functions.LootingEnchantBonus; | ||
import net.minecraft.world.storage.loot.functions.SetCount; | ||
import net.minecraftforge.event.LootTableLoadEvent; | ||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; | ||
import net.minecraftforge.fml.common.eventhandler.EventPriority; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import thaumcraft.Thaumcraft; | ||
|
||
@EventBusSubscriber(modid = CrimsonRevelations.MODID) | ||
public class LootTableHandler { | ||
public static final ResourceLocation CULTIST = new ResourceLocation(CrimsonRevelations.MODID, ("entities/cultist")); | ||
public static final ResourceLocation LESSER_CULTIST_PORTAL = new ResourceLocation(CrimsonRevelations.MODID, ("entities/lesser_cultist_portal")); | ||
|
||
// Bosses | ||
public static final ResourceLocation OVERGROWN_TAINTACLE = new ResourceLocation(CrimsonRevelations.MODID, ("entities/boss/overgrown_taintacle")); | ||
|
||
@SubscribeEvent(priority = EventPriority.LOWEST) | ||
@SubscribeEvent | ||
public static void onLootTableLoad(LootTableLoadEvent event) { | ||
if (event.getName().equals(new ResourceLocation(Thaumcraft.MODID, "cultist"))) { | ||
LootTable lootCultist = event.getLootTableManager().getLootTableFromLocation(CULTIST); | ||
event.getTable().addPool(lootCultist.getPool("crimson_material")); | ||
LootPool crimson_material_pool = event.getTable().getPool("crimson_material"); | ||
|
||
if (crimson_material_pool == null) { | ||
crimson_material_pool = new LootPool(new LootEntry[0], new LootCondition[0], new RandomValueRange(1, 1), new RandomValueRange(1, 1), "crimson_material"); | ||
event.getTable().addPool(crimson_material_pool); | ||
} | ||
|
||
if (crimson_material_pool != null) { | ||
crimson_material_pool.addEntry(new LootEntryItem(new ItemStack(RegistryHandler.crimsonFabric).getItem(), 1, 0, | ||
new LootFunction[]{new SetCount(new LootCondition[]{new KilledByPlayer(false)}, new RandomValueRange(0, 1)), | ||
new LootingEnchantBonus(new LootCondition[0], new RandomValueRange(0, 1), 3)}, | ||
new LootCondition[0], "crimsonrevelations:crimson_fabric")); | ||
crimson_material_pool.addEntry(new LootEntryItem(new ItemStack(RegistryHandler.crimsonPlate).getItem(), 1, 0, | ||
new LootFunction[]{new SetCount(new LootCondition[]{new KilledByPlayer(false)}, new RandomValueRange(0, 1)), | ||
new LootingEnchantBonus(new LootCondition[0], new RandomValueRange(0, 1), 3)}, | ||
new LootCondition[0], "crimsonrevelations:crimson_plate")); | ||
} | ||
} | ||
} | ||
} |
62 changes: 0 additions & 62 deletions
62
src/main/resources/assets/crimsonrevelations/loot_tables/entities/cultist.json
This file was deleted.
Oops, something went wrong.