Package net.minecraft.data.loot
Class BlockLootSubProvider
java.lang.Object
net.minecraft.data.loot.BlockLootSubProvider
- All Implemented Interfaces:
LootTableSubProvider
- Direct Known Subclasses:
VanillaBlockLoot
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FeatureFlagSetprotected static final LootItemCondition.Builderprotected final Map<ResourceKey<LootTable>, LootTable.Builder> protected static final float[]private static final float[]protected final HolderLookup.Provider -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBlockLootSubProvider(Set<Item> explosionResistant, FeatureFlagSet enabledFeatures, Map<ResourceKey<LootTable>, LootTable.Builder> map, HolderLookup.Provider registries) protectedBlockLootSubProvider(Set<Item> explosionResistant, FeatureFlagSet enabledFeatures, HolderLookup.Provider registries) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd(Block block, Function<Block, LootTable.Builder> factory) protected voidadd(Block block, LootTable.Builder builder) protected voidaddNetherVinesDropTable(Block vines, Block plant) protected <T extends ConditionUserBuilder<T>>
TapplyExplosionCondition(ItemLike item, ConditionUserBuilder<T> conditionBuilder) protected <T extends FunctionUserBuilder<T>>
TapplyExplosionDecay(ItemLike item, FunctionUserBuilder<T> functionBuilder) createAttachedStemDrops(Block block, Item item) protected LootTable.BuildercreateBannerDrop(Block block) protected LootTable.BuildercreateBeeHiveDrop(Block block) protected LootTable.BuildercreateBeeNestDrop(Block block) protected static LootTable.BuildercreateCandleCakeDrops(Block candleCakeBlock) protected LootTable.BuildercreateCandleDrops(Block candleBlock) protected LootTable.BuildercreateCaveVinesDrop(Block block) protected LootTable.BuildercreateCopperOreDrops(Block block) protected LootTable.BuildercreateCropDrops(Block cropBlock, Item grownCropItem, Item seedsItem, LootItemCondition.Builder dropGrownCropCondition) IfdropGrownCropConditionfails (i.e.protected LootTable.BuildercreateDoorTable(Block doorBlock) protected LootTable.BuildercreateDoublePlantShearsDrop(Block sheared) protected LootTable.BuildercreateDoublePlantWithSeedDrops(Block block, Block sheared) protected LootTable.BuildercreateGrassDrops(Block block) protected LootTable.BuildercreateLapisOreDrops(Block block) protected LootTable.BuildercreateLeavesDrops(Block leavesBlock, Block saplingBlock, float... chances) Used for all leaves, drops self with silk touch, otherwise drops the second Block param with the passed chances for fortune levels, adding in sticks.protected LootTable.BuildercreateMangroveLeavesDrops(Block block) protected LootTable.BuildercreateMultifaceBlockDrops(Block block, LootItemCondition.Builder builder) protected LootTable.BuildercreateMushroomBlockDrop(Block block, ItemLike item) protected LootTable.Builderprotected LootTable.BuildercreateOakLeavesDrops(Block oakLeavesBlock, Block saplingBlock, float... chances) Used for oak and dark oak, same as droppingWithChancesAndSticks but adding in apples.protected LootTable.BuildercreateOreDrop(Block block, Item item) protected LootTable.BuildercreatePetalsDrops(Block petalBlock) protected LootTable.Builderprotected LootTable.BuildercreateRedstoneOreDrops(Block block) protected static LootTable.BuildercreateSelfDropDispatchTable(Block block, LootItemCondition.Builder conditionBuilder, LootPoolEntryContainer.Builder<?> alternativeBuilder) If the condition fromconditionBuildersucceeds, drops 1block.protected LootTable.BuildercreateShearsDispatchTable(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined with Shears, drops 1block.protected static LootTable.BuildercreateShearsOnlyDrop(ItemLike item) protected LootTable.BuildercreateShulkerBoxDrop(Block block) protected LootTable.BuildercreateSilkTouchDispatchTable(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined with Silk Touch, drops 1block.protected LootTable.Builderprotected LootTable.BuildercreateSilkTouchOrShearsDispatchTable(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined either with Silk Touch or Shears, drops 1block.protected LootTable.BuildercreateSingleItemTable(ItemLike item, NumberProvider count) protected LootTable.BuildercreateSingleItemTableWithSilkTouch(Block block, ItemLike item) protected LootTable.BuildercreateSingleItemTableWithSilkTouch(Block block, ItemLike item, NumberProvider count) protected <T extends Comparable<T> & StringRepresentable>
LootTable.BuildercreateSinglePropConditionTable(Block block, Property<T> property, T value) protected LootTable.BuildercreateSlabItemTable(Block block) createStemDrops(Block block, Item item) Creates a builder that drops the given IItemProvider in amounts between 0 and 3, based on the AGE property.private LootItemCondition.Builderprotected LootItemCondition.Builderprotected voidprotected voiddropPottedContents(Block flowerPot) protected voidprotected voiddropWhenSilkTouch(Block block) protected abstract voidgenerate()voidgenerate(BiConsumer<ResourceKey<LootTable>, LootTable.Builder> output) private LootItemCondition.Builderprotected LootItemCondition.Builderstatic LootTable.BuildernoDrop()protected voidotherWhenSilkTouch(Block block, Block other)
-
Field Details
-
HAS_SHEARS
-
registries
-
explosionResistant
-
enabledFeatures
-
map
-
NORMAL_LEAVES_SAPLING_CHANCES
protected static final float[] NORMAL_LEAVES_SAPLING_CHANCES -
NORMAL_LEAVES_STICK_CHANCES
private static final float[] NORMAL_LEAVES_STICK_CHANCES
-
-
Constructor Details
-
BlockLootSubProvider
protected BlockLootSubProvider(Set<Item> explosionResistant, FeatureFlagSet enabledFeatures, HolderLookup.Provider registries) -
BlockLootSubProvider
protected BlockLootSubProvider(Set<Item> explosionResistant, FeatureFlagSet enabledFeatures, Map<ResourceKey<LootTable>, LootTable.Builder> map, HolderLookup.Provider registries)
-
-
Method Details
-
hasSilkTouch
-
doesNotHaveSilkTouch
-
hasShearsOrSilkTouch
-
doesNotHaveShearsOrSilkTouch
-
applyExplosionDecay
protected <T extends FunctionUserBuilder<T>> T applyExplosionDecay(ItemLike item, FunctionUserBuilder<T> functionBuilder) -
applyExplosionCondition
protected <T extends ConditionUserBuilder<T>> T applyExplosionCondition(ItemLike item, ConditionUserBuilder<T> conditionBuilder) -
createSingleItemTable
-
createSelfDropDispatchTable
protected static LootTable.Builder createSelfDropDispatchTable(Block block, LootItemCondition.Builder conditionBuilder, LootPoolEntryContainer.Builder<?> alternativeBuilder) If the condition fromconditionBuildersucceeds, drops 1block. Otherwise, drops loot specified byalternativeBuilder. -
createSilkTouchDispatchTable
protected LootTable.Builder createSilkTouchDispatchTable(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined with Silk Touch, drops 1block. Otherwise, drops loot specified bybuilder. -
createShearsDispatchTable
protected LootTable.Builder createShearsDispatchTable(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined with Shears, drops 1block. Otherwise, drops loot specified bybuilder. -
createSilkTouchOrShearsDispatchTable
protected LootTable.Builder createSilkTouchOrShearsDispatchTable(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined either with Silk Touch or Shears, drops 1block. Otherwise, drops loot specified bybuilder. -
createSingleItemTableWithSilkTouch
-
createSingleItemTable
-
createSingleItemTableWithSilkTouch
protected LootTable.Builder createSingleItemTableWithSilkTouch(Block block, ItemLike item, NumberProvider count) -
createSilkTouchOnlyTable
-
createPotFlowerItemTable
-
createSlabItemTable
-
createSinglePropConditionTable
protected <T extends Comparable<T> & StringRepresentable> LootTable.Builder createSinglePropConditionTable(Block block, Property<T> property, T value) -
createNameableBlockEntityTable
-
createShulkerBoxDrop
-
createCopperOreDrops
-
createLapisOreDrops
-
createRedstoneOreDrops
-
createBannerDrop
-
createBeeNestDrop
-
createBeeHiveDrop
-
createCaveVinesDrop
-
createOreDrop
-
createMushroomBlockDrop
-
createGrassDrops
-
createStemDrops
Creates a builder that drops the given IItemProvider in amounts between 0 and 3, based on the AGE property. Only used in vanilla for pumpkin and melon stems. -
createAttachedStemDrops
-
createShearsOnlyDrop
-
createMultifaceBlockDrops
protected LootTable.Builder createMultifaceBlockDrops(Block block, LootItemCondition.Builder builder) -
createLeavesDrops
protected LootTable.Builder createLeavesDrops(Block leavesBlock, Block saplingBlock, float... chances) Used for all leaves, drops self with silk touch, otherwise drops the second Block param with the passed chances for fortune levels, adding in sticks. -
createOakLeavesDrops
protected LootTable.Builder createOakLeavesDrops(Block oakLeavesBlock, Block saplingBlock, float... chances) Used for oak and dark oak, same as droppingWithChancesAndSticks but adding in apples. -
createMangroveLeavesDrops
-
createCropDrops
protected LootTable.Builder createCropDrops(Block cropBlock, Item grownCropItem, Item seedsItem, LootItemCondition.Builder dropGrownCropCondition) IfdropGrownCropConditionfails (i.e. crop is not ready), drops 1seedsItem. IfdropGrownCropConditionsucceeds (i.e. crop is ready), drops 1grownCropItem, and 0-3seedsItemwith fortune applied. -
createDoublePlantShearsDrop
-
createDoublePlantWithSeedDrops
-
createCandleDrops
-
createPetalsDrops
-
createCandleCakeDrops
-
noDrop
-
generate
protected abstract void generate() -
getKnownBlocks
-
generate
- Specified by:
generatein interfaceLootTableSubProvider
-
addNetherVinesDropTable
-
createDoorTable
-
dropPottedContents
-
otherWhenSilkTouch
-
dropOther
-
dropWhenSilkTouch
-
dropSelf
-
add
-
add
-