VanillaFishingLoot.java
net.minecraft.data.loot.packs.VanillaFishingLoot
信息
- 全限定名:net.minecraft.data.loot.packs.VanillaFishingLoot
- 类型:public record
- 包:net.minecraft.data.loot.packs
- 源码路径:src/main/java/net/minecraft/data/loot/packs/VanillaFishingLoot.java
- 起始行号:L32
- 实现:LootTableSubProvider
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public void generate(BiConsumer<ResourceKey<LootTable>,LootTable.Builder> output) @ L33
- 方法名:generate
- 源码定位:L33
- 返回类型:void
- 修饰符:public
参数:
- output: BiConsumer<ResourceKey
,LootTable.Builder>
说明:
TODO
public static LootTable.Builder fishingFishLootTable() @ L124
- 方法名:fishingFishLootTable
- 源码定位:L124
- 返回类型:LootTable.Builder
- 修饰符:public static
参数:
- 无
说明:
TODO
代码
public record VanillaFishingLoot(HolderLookup.Provider registries) implements LootTableSubProvider {
@Override
public void generate(BiConsumer<ResourceKey<LootTable>, LootTable.Builder> output) {
HolderLookup.RegistryLookup<Biome> biomes = this.registries.lookupOrThrow(Registries.BIOME);
output.accept(
BuiltInLootTables.FISHING,
LootTable.lootTable()
.withPool(
LootPool.lootPool()
.setRolls(ConstantValue.exactly(1.0F))
.add(NestedLootTable.lootTableReference(BuiltInLootTables.FISHING_JUNK).setWeight(10).setQuality(-2))
.add(
NestedLootTable.lootTableReference(BuiltInLootTables.FISHING_TREASURE)
.setWeight(5)
.setQuality(2)
.when(
LootItemEntityPropertyCondition.hasProperties(
LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().subPredicate(FishingHookPredicate.inOpenWater(true))
)
)
)
.add(NestedLootTable.lootTableReference(BuiltInLootTables.FISHING_FISH).setWeight(85).setQuality(-1))
)
);
output.accept(BuiltInLootTables.FISHING_FISH, fishingFishLootTable());
output.accept(
BuiltInLootTables.FISHING_JUNK,
LootTable.lootTable()
.withPool(
LootPool.lootPool()
.add(LootItem.lootTableItem(Blocks.LILY_PAD).setWeight(17))
.add(
LootItem.lootTableItem(Items.LEATHER_BOOTS)
.setWeight(10)
.apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.0F, 0.9F)))
)
.add(LootItem.lootTableItem(Items.LEATHER).setWeight(10))
.add(LootItem.lootTableItem(Items.BONE).setWeight(10))
.add(LootItem.lootTableItem(Items.POTION).setWeight(10).apply(SetPotionFunction.setPotion(Potions.WATER)))
.add(LootItem.lootTableItem(Items.STRING).setWeight(5))
.add(
LootItem.lootTableItem(Items.FISHING_ROD).setWeight(2).apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.0F, 0.9F)))
)
.add(LootItem.lootTableItem(Items.BOWL).setWeight(10))
.add(LootItem.lootTableItem(Items.STICK).setWeight(5))
.add(LootItem.lootTableItem(Items.INK_SAC).setWeight(1).apply(SetItemCountFunction.setCount(ConstantValue.exactly(10.0F))))
.add(LootItem.lootTableItem(Blocks.TRIPWIRE_HOOK).setWeight(10))
.add(LootItem.lootTableItem(Items.ROTTEN_FLESH).setWeight(10))
.add(
LootItem.lootTableItem(Blocks.BAMBOO)
.when(
LocationCheck.checkLocation(
LocationPredicate.Builder.location()
.setBiomes(
HolderSet.direct(
biomes.getOrThrow(Biomes.JUNGLE),
biomes.getOrThrow(Biomes.SPARSE_JUNGLE),
biomes.getOrThrow(Biomes.BAMBOO_JUNGLE)
)
)
)
)
.setWeight(10)
)
)
);
output.accept(
BuiltInLootTables.FISHING_TREASURE,
LootTable.lootTable()
.withPool(
LootPool.lootPool()
.add(LootItem.lootTableItem(Items.NAME_TAG))
.add(LootItem.lootTableItem(Items.SADDLE))
.add(
LootItem.lootTableItem(Items.BOW)
.apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.0F, 0.25F)))
.apply(EnchantWithLevelsFunction.enchantWithLevels(this.registries, ConstantValue.exactly(30.0F)))
)
.add(
LootItem.lootTableItem(Items.FISHING_ROD)
.apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.0F, 0.25F)))
.apply(EnchantWithLevelsFunction.enchantWithLevels(this.registries, ConstantValue.exactly(30.0F)))
)
.add(
LootItem.lootTableItem(Items.BOOK)
.apply(EnchantWithLevelsFunction.enchantWithLevels(this.registries, ConstantValue.exactly(30.0F)))
)
.add(LootItem.lootTableItem(Items.NAUTILUS_SHELL))
)
);
}
public static LootTable.Builder fishingFishLootTable() {
return LootTable.lootTable()
.withPool(
LootPool.lootPool()
.add(LootItem.lootTableItem(Items.COD).setWeight(60))
.add(LootItem.lootTableItem(Items.SALMON).setWeight(25))
.add(LootItem.lootTableItem(Items.TROPICAL_FISH).setWeight(2))
.add(LootItem.lootTableItem(Items.PUFFERFISH).setWeight(13))
);
}
}引用的其他类
-
- 引用位置:
方法调用 - 关联成员:
EntityPredicate.Builder.entity()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
FishingHookPredicate.inOpenWater()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
LocationPredicate.Builder.location()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
HolderSet.direct()
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
LootPool.lootPool()
- 引用位置:
-
- 引用位置:
参数/方法调用/返回值 - 关联成员:
LootTable.lootTable()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
LootItem.lootTableItem()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
NestedLootTable.lootTableReference()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
EnchantWithLevelsFunction.enchantWithLevels()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
SetItemCountFunction.setCount()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
SetItemDamageFunction.setDamage()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
SetPotionFunction.setPotion()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
LocationCheck.checkLocation()
- 引用位置:
-
LootItemEntityPropertyCondition
- 引用位置:
方法调用 - 关联成员:
LootItemEntityPropertyCondition.hasProperties()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ConstantValue.exactly()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
UniformGenerator.between()
- 引用位置: