package net.minecraft.data.loot.packs; import net.minecraft.advancements.predicates.DamageSourcePredicate; import net.minecraft.advancements.predicates.MinMaxBounds; import net.minecraft.advancements.predicates.TagPredicate; import net.minecraft.advancements.predicates.entity.CubeMobPredicate; import net.minecraft.advancements.predicates.entity.EntityFlagsPredicate; import net.minecraft.advancements.predicates.entity.EntityPredicate; import net.minecraft.advancements.predicates.entity.EntityTypePredicate; import net.minecraft.advancements.predicates.entity.RaiderPredicate; import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; import net.minecraft.data.loot.EntityLootSubProvider; import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.EntityTypeTags; import net.minecraft.tags.ItemTags; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.animal.frog.FrogVariant; import net.minecraft.world.entity.animal.frog.FrogVariants; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.ColorCollection; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.entries.EmptyLootItem; import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.entries.NestedLootTable; import net.minecraft.world.level.storage.loot.entries.TagEntry; import net.minecraft.world.level.storage.loot.functions.EnchantedCountIncreaseFunction; import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; import net.minecraft.world.level.storage.loot.functions.SetOminousBottleAmplifierFunction; import net.minecraft.world.level.storage.loot.functions.SetPotionFunction; import net.minecraft.world.level.storage.loot.functions.SmeltItemFunction; import net.minecraft.world.level.storage.loot.predicates.DamageSourceCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemEntityPropertyCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemKilledByPlayerCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceWithEnchantedBonusCondition; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; public class VanillaEntityLoot extends EntityLootSubProvider { public VanillaEntityLoot(final HolderLookup.Provider registries) { super(FeatureFlags.REGISTRY.allFlags(), registries); } @Override public void generate() { HolderGetter> entityTypes = this.registries.lookupOrThrow(Registries.ENTITY_TYPE); HolderGetter frogVariants = this.registries.lookupOrThrow(Registries.FROG_VARIANT); this.add(EntityTypes.ALLAY, LootTable.lootTable()); this.add(EntityTypes.ARMADILLO, LootTable.lootTable()); this.add(EntityTypes.ARMOR_STAND, LootTable.lootTable()); this.add(EntityTypes.AXOLOTL, LootTable.lootTable()); this.add(EntityTypes.BAT, LootTable.lootTable()); this.add(EntityTypes.BEE, LootTable.lootTable()); this.add( EntityTypes.BLAZE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BLAZE_ROD) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.BOGGED, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ARROW) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BONE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.TIPPED_ARROW) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F)).setLimit(1)) .apply(SetPotionFunction.setPotion(Potions.POISON)) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.CAT, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.STRING).apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F)))) ) ); this.add(EntityTypes.CAMEL, LootTable.lootTable()); this.add( EntityTypes.CAMEL_HUSK, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 3.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.CAVE_SPIDER, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.STRING) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.SPIDER_EYE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(-1.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.CHICKEN, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.FEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.CHICKEN) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.COD, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.COD).apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot()))) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.BONE_MEAL)) .when(LootItemRandomChanceCondition.randomChance(0.05F)) ) ); this.add( EntityTypes.COPPER_GOLEM, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.COPPER_INGOT) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.COW, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.LEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BEEF) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.CREEPER, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.GUNPOWDER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .add(TagEntry.expandTag(ItemTags.CREEPER_DROP_MUSIC_DISCS)) .when( LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.ATTACKER, EntityPredicate.Builder.entity().of(entityTypes, EntityTypeTags.SKELETONS) ) ) ) ); this.add( EntityTypes.DOLPHIN, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.COD) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) ) ) ); this.add( EntityTypes.DONKEY, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.LEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.DROWNED, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.COPPER_INGOT)) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.11F, 0.02F)) ) ); this.add(EntityTypes.ELDER_GUARDIAN, this.elderGuardianLootTable()); this.add(EntityTypes.ENDER_DRAGON, LootTable.lootTable()); this.add( EntityTypes.ENDERMAN, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ENDER_PEARL) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add(EntityTypes.ENDERMITE, LootTable.lootTable()); this.add( EntityTypes.EVOKER, LootTable.lootTable() .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.TOTEM_OF_UNDYING))) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.EMERALD) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.BREEZE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BREEZE_ROD) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(1.0F, 2.0F))) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add(EntityTypes.FOX, LootTable.lootTable()); this.add(EntityTypes.FROG, LootTable.lootTable()); this.add( EntityTypes.GHAST, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.GHAST_TEAR) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.GUNPOWDER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.MUSIC_DISC_TEARS)) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) .when( DamageSourceCondition.hasDamageSource( DamageSourcePredicate.Builder.damageType() .tag(TagPredicate.is(DamageTypeTags.IS_PROJECTILE)) .direct(EntityPredicate.Builder.entity().of(entityTypes, EntityTypes.FIREBALL)) ) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add(EntityTypes.HAPPY_GHAST, LootTable.lootTable()); this.add(EntityTypes.GIANT, LootTable.lootTable()); this.add( EntityTypes.GLOW_SQUID, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.GLOW_INK_SAC) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add(EntityTypes.GOAT, LootTable.lootTable()); this.add( EntityTypes.GUARDIAN, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.PRISMARINE_SHARD) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.COD) .setWeight(2) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) ) .add( LootItem.lootTableItem(Items.PRISMARINE_CRYSTALS) .setWeight(2) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .add(EmptyLootItem.emptyItem()) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(NestedLootTable.lootTableReference(BuiltInLootTables.FISHING_FISH).apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot()))) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.025F, 0.01F)) ) ); this.add( EntityTypes.HORSE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.LEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.HUSK, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.RABBIT_FOOT) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) .when( LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity() .vehicle(EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(entityTypes, EntityTypes.CAMEL_HUSK))) .build() ) ) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.IRON_INGOT)) .add(LootItem.lootTableItem(Items.CARROT)) .add(LootItem.lootTableItem(Items.POTATO).apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot()))) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.025F, 0.01F)) ) ); this.add( EntityTypes.RAVAGER, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.SADDLE).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F)))) ) ); this.add(EntityTypes.ILLUSIONER, LootTable.lootTable()); this.add( EntityTypes.IRON_GOLEM, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Blocks.POPPY).apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F)))) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.IRON_INGOT).apply(SetItemCountFunction.setCount(UniformGenerator.between(3.0F, 5.0F)))) ) ); this.add( EntityTypes.LLAMA, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.LEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.MAGMA_CUBE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.MAGMA_CREAM) .apply(SetItemCountFunction.setCount(UniformGenerator.between(-2.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) .when(this.killedByFrog(entityTypes).invert()) .when( LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().cubeMob(CubeMobPredicate.sized(MinMaxBounds.Ints.atLeast(2))) ) ) ) .add( LootItem.lootTableItem(Items.PEARLESCENT_FROGLIGHT) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) .when(this.killedByFrogVariant(entityTypes, frogVariants, FrogVariants.WARM)) ) .add( LootItem.lootTableItem(Items.VERDANT_FROGLIGHT) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) .when(this.killedByFrogVariant(entityTypes, frogVariants, FrogVariants.COLD)) ) .add( LootItem.lootTableItem(Items.OCHRE_FROGLIGHT) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) .when(this.killedByFrogVariant(entityTypes, frogVariants, FrogVariants.TEMPERATE)) ) ) ); this.add(EntityTypes.SULFUR_CUBE, LootTable.lootTable()); this.add(EntityTypes.MANNEQUIN, LootTable.lootTable()); this.add( EntityTypes.MULE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.LEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.MOOSHROOM, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.LEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BEEF) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.NAUTILUS, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.NAUTILUS_SHELL)) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.05F, 0.01F)) ) ); this.add(EntityTypes.OCELOT, LootTable.lootTable()); this.add( EntityTypes.PANDA, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Blocks.BAMBOO).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F)))) ) ); this.add( EntityTypes.PARROT, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.FEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.PHANTOM, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.PHANTOM_MEMBRANE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.PIG, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.PORKCHOP) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.PILLAGER, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.OMINOUS_BOTTLE) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) .apply(SetOminousBottleAmplifierFunction.setAmplifier(UniformGenerator.between(0.0F, 4.0F))) ) .when( LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().raider(RaiderPredicate.CAPTAIN_WITHOUT_RAID) ) ) ) ); this.add(EntityTypes.PLAYER, LootTable.lootTable()); this.add( EntityTypes.POLAR_BEAR, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.COD) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .setWeight(3) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .add( LootItem.lootTableItem(Items.SALMON) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.PUFFERFISH, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.PUFFERFISH).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F)))) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.BONE_MEAL)) .when(LootItemRandomChanceCondition.randomChance(0.05F)) ) ); this.add( EntityTypes.RABBIT, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.RABBIT_HIDE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.RABBIT) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.RABBIT_FOOT)) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.1F, 0.03F)) ) ); this.add( EntityTypes.SALMON, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.SALMON).apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot()))) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.BONE_MEAL)) .when(LootItemRandomChanceCondition.randomChance(0.05F)) ) ); this.add( EntityTypes.SHEEP, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.MUTTON) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool(createSheepDispatchPool(BuiltInLootTables.SHEEP)) ); ColorCollection.zipApply( BuiltInLootTables.SHEEP, Blocks.WOOL, (sheep, wool) -> this.add(EntityTypes.SHEEP, sheep, LootTable.lootTable().withPool(LootPool.lootPool().add(LootItem.lootTableItem(wool)))) ); this.add( EntityTypes.SHULKER, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.SHULKER_SHELL)) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.5F, 0.0625F)) ) ); this.add(EntityTypes.SILVERFISH, LootTable.lootTable()); this.add( EntityTypes.SKELETON, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ARROW) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BONE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.SKELETON_HORSE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BONE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.SLIME, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.SLIME_BALL) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) .when(this.killedByFrog(entityTypes).invert()) ) .add(LootItem.lootTableItem(Items.SLIME_BALL).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))).when(this.killedByFrog(entityTypes))) .when( LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity().cubeMob(CubeMobPredicate.sized(MinMaxBounds.Ints.exactly(1))) ) ) ) ); this.add(EntityTypes.SNIFFER, LootTable.lootTable()); this.add( EntityTypes.SNOW_GOLEM, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.SNOWBALL).apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 15.0F)))) ) ); this.add( EntityTypes.SPIDER, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.STRING) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.SPIDER_EYE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(-1.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.SQUID, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.INK_SAC) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.STRAY, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ARROW) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BONE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.TIPPED_ARROW) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F)).setLimit(1)) .apply(SetPotionFunction.setPotion(Potions.SLOWNESS)) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.PARCHED, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ARROW) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BONE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.TIPPED_ARROW) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F)).setLimit(1)) .apply(SetPotionFunction.setPotion(Potions.WEAKNESS)) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.STRIDER, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.STRING) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 5.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add(EntityTypes.TADPOLE, LootTable.lootTable()); this.add( EntityTypes.TRADER_LLAMA, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.LEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.TROPICAL_FISH, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.TROPICAL_FISH).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F)))) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.BONE_MEAL)) .when(LootItemRandomChanceCondition.randomChance(0.05F)) ) ); this.add( EntityTypes.TURTLE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Blocks.SEAGRASS) .setWeight(3) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.BOWL)) .when(DamageSourceCondition.hasDamageSource(DamageSourcePredicate.Builder.damageType().tag(TagPredicate.is(DamageTypeTags.IS_LIGHTNING)))) ) ); this.add(EntityTypes.VEX, LootTable.lootTable()); this.add(EntityTypes.VILLAGER, LootTable.lootTable()); this.add( EntityTypes.WARDEN, LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.SCULK_CATALYST))) ); this.add(EntityTypes.WANDERING_TRADER, LootTable.lootTable()); this.add( EntityTypes.VINDICATOR, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.EMERALD) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.WITCH, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(UniformGenerator.between(1.0F, 3.0F)) .add( LootItem.lootTableItem(Items.GLOWSTONE_DUST) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .add( LootItem.lootTableItem(Items.SUGAR) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .add( LootItem.lootTableItem(Items.SPIDER_EYE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .add( LootItem.lootTableItem(Items.GLASS_BOTTLE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .add( LootItem.lootTableItem(Items.GUNPOWDER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .add( LootItem.lootTableItem(Items.STICK) .setWeight(2) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.REDSTONE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(4.0F, 8.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add(EntityTypes.WITHER, LootTable.lootTable()); this.add( EntityTypes.WITHER_SKELETON, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.COAL) .apply(SetItemCountFunction.setCount(UniformGenerator.between(-1.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.BONE) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Blocks.WITHER_SKELETON_SKULL)) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.025F, 0.01F)) ) ); this.add(EntityTypes.WOLF, LootTable.lootTable()); this.add( EntityTypes.ZOGLIN, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add(EntityTypes.CREAKING, LootTable.lootTable()); this.add( EntityTypes.ZOMBIE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.RED_MUSHROOM) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) .when( LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity() .vehicle(EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(entityTypes, EntityTypes.ZOMBIE_HORSE))) .build() ) ) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.IRON_INGOT)) .add(LootItem.lootTableItem(Items.CARROT)) .add(LootItem.lootTableItem(Items.POTATO).apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot()))) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.025F, 0.01F)) ) .withPool( LootPool.lootPool() .add(LootItem.lootTableItem(Items.MUSIC_DISC_LAVA_CHICKEN)) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when( LootItemEntityPropertyCondition.hasProperties( LootContext.EntityTarget.THIS, EntityPredicate.Builder.entity() .flags(EntityFlagsPredicate.Builder.flags().setIsBaby(true)) .vehicle(EntityPredicate.Builder.entity().of(entityTypes, EntityTypes.CHICKEN)) ) ) ) ); this.add( EntityTypes.ZOMBIE_HORSE, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 3.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add( EntityTypes.ZOMBIE_NAUTILUS, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 3.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) ); this.add( EntityTypes.ZOMBIFIED_PIGLIN, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.GOLD_NUGGET) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.GOLD_INGOT)) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.025F, 0.01F)) ) ); this.add( EntityTypes.HOGLIN, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.PORKCHOP) .apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 4.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.LEATHER) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 1.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) ); this.add(EntityTypes.PIGLIN, LootTable.lootTable()); this.add(EntityTypes.PIGLIN_BRUTE, LootTable.lootTable()); this.add( EntityTypes.ZOMBIE_VILLAGER, LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.ROTTEN_FLESH) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Items.IRON_INGOT)) .add(LootItem.lootTableItem(Items.CARROT)) .add(LootItem.lootTableItem(Items.POTATO).apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot()))) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.025F, 0.01F)) ) ); } public LootTable.Builder elderGuardianLootTable() { return LootTable.lootTable() .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.PRISMARINE_SHARD) .apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add( LootItem.lootTableItem(Items.COD) .setWeight(3) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) .apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot())) ) .add( LootItem.lootTableItem(Items.PRISMARINE_CRYSTALS) .setWeight(2) .apply(EnchantedCountIncreaseFunction.lootingMultiplier(this.registries, UniformGenerator.between(0.0F, 1.0F))) ) .add(EmptyLootItem.emptyItem()) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(Blocks.WET_SPONGE)) .when(LootItemKilledByPlayerCondition.killedByPlayer()) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(NestedLootTable.lootTableReference(BuiltInLootTables.FISHING_FISH).apply(SmeltItemFunction.smelted().when(this.shouldSmeltLoot()))) .when(LootItemKilledByPlayerCondition.killedByPlayer()) .when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(this.registries, 0.025F, 0.01F)) ) .withPool( LootPool.lootPool() .setRolls(ConstantValue.exactly(1.0F)) .add(EmptyLootItem.emptyItem().setWeight(4)) .add(LootItem.lootTableItem(Items.TIDE_ARMOR_TRIM_SMITHING_TEMPLATE).setWeight(1)) ); } }