Added fishing junk loot (#2869)

Rubber and tree tap
This commit is contained in:
Ayutac 2022-03-30 11:23:55 +02:00 committed by GitHub
parent fa0b47c0a8
commit 3f28d3903f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 11 deletions

View file

@ -605,6 +605,9 @@ public class TechRebornConfig {
@Config(config = "world", category = "loot", key = "enableEndLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to The End loot chests.")
public static boolean enableEndLoot = true;
@Config(config = "world", category = "loot", key = "enableFishingJunkLoot", comment = "When true TechReborn will add items to fishing junk loot.")
public static boolean enableFishingJunkLoot = true;
@Config(config = "world", category = "generation", key = "enableOreGeneration", comment = "When enabled ores will generate in the world")
public static boolean enableOreGeneration = true;

View file

@ -32,6 +32,7 @@ import net.minecraft.loot.LootPool;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.entry.LootPoolEntry;
import net.minecraft.loot.function.SetCountLootFunction;
import net.minecraft.loot.function.SetDamageLootFunction;
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent.Ingots;
@ -51,6 +52,11 @@ public class ModLoot {
LootPoolEntry basicCircuit = makeEntry(Parts.ELECTRONIC_CIRCUIT);
LootPoolEntry rubberSapling = makeEntry(TRContent.RUBBER_SAPLING, 25);
LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot)
.withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedIronIngot).withEntry(advancedAlloyIngot)
.withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootNumberProvider.create(1.0f, 2.0f))
.build();
LootPoolEntry aluminumIngot = makeEntry(Ingots.ALUMINUM);
LootPoolEntry electrumIngot = makeEntry(Ingots.ELECTRUM);
LootPoolEntry invarIngot = makeEntry(Ingots.INVAR);
@ -61,6 +67,11 @@ public class ModLoot {
LootPoolEntry advancedCircuit = makeEntry(Parts.ADVANCED_CIRCUIT);
LootPoolEntry dataStorageChip = makeEntry(Parts.DATA_STORAGE_CHIP);
LootPool poolAdvanced = FabricLootPoolBuilder.builder().withEntry(aluminumIngot).withEntry(electrumIngot)
.withEntry(invarIngot).withEntry(nickelIngot).withEntry(steelIngot).withEntry(zincIngot)
.withEntry(advancedFrame).withEntry(advancedCircuit).withEntry(dataStorageChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f))
.build();
LootPoolEntry chromeIngot = makeEntry(Ingots.CHROME);
LootPoolEntry iridiumIngot = makeEntry(Ingots.IRIDIUM);
LootPoolEntry platinumIngot = makeEntry(Ingots.PLATINUM);
@ -71,22 +82,17 @@ public class ModLoot {
LootPoolEntry industrialCircuit = makeEntry(Parts.INDUSTRIAL_CIRCUIT);
LootPoolEntry energyFlowChip = makeEntry(Parts.ENERGY_FLOW_CHIP);
LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot)
.withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedIronIngot).withEntry(advancedAlloyIngot)
.withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootNumberProvider.create(1.0f, 2.0f))
.build();
LootPool poolAdvanced = FabricLootPoolBuilder.builder().withEntry(aluminumIngot).withEntry(electrumIngot)
.withEntry(invarIngot).withEntry(nickelIngot).withEntry(steelIngot).withEntry(zincIngot)
.withEntry(advancedFrame).withEntry(advancedCircuit).withEntry(dataStorageChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f))
.build();
LootPool poolIndustrial = FabricLootPoolBuilder.builder().withEntry(chromeIngot).withEntry(iridiumIngot)
.withEntry(platinumIngot).withEntry(titaniumIngot).withEntry(tungstenIngot).withEntry(tungstensteelIngot)
.withEntry(industrialFrame).withEntry(industrialCircuit).withEntry(energyFlowChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f))
.build();
LootPoolEntry rubber = ItemEntry.builder(Parts.RUBBER).weight(10).build();
LootPoolEntry treeTap = ItemEntry.builder(TRContent.TREE_TAP).weight(10)
.apply(SetDamageLootFunction.builder(UniformLootNumberProvider.create(0.0f, 0.9f))).build();
LootPool poolFishingJunk = FabricLootPoolBuilder.builder().withEntry(rubber).withEntry(treeTap).build();
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, ident, supplier, setter) -> {
String stringId = ident.toString();
if (!stringId.startsWith("minecraft:chests")) {
@ -133,6 +139,12 @@ public class ModLoot {
}
}
if (TechRebornConfig.enableFishingJunkLoot) {
if (stringId.equals("minecraft:gameplay/fishing/junk")) {
supplier.withPool(poolFishingJunk);
}
}
});
}