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 FeatureFlagSet
protected static final LootItemCondition.Builder
protected final Map
<ResourceKey<LootTable>, LootTable.Builder> protected static final float[]
private static final float[]
protected final HolderLookup.Provider
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BlockLootSubProvider
(Set<Item> explosionResistant, FeatureFlagSet enabledFeatures, Map<ResourceKey<LootTable>, LootTable.Builder> map, HolderLookup.Provider registries) protected
BlockLootSubProvider
(Set<Item> explosionResistant, FeatureFlagSet enabledFeatures, HolderLookup.Provider registries) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
add
(Block block, Function<Block, LootTable.Builder> factory) protected void
add
(Block block, LootTable.Builder builder) protected void
addNetherVinesDropTable
(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.Builder
createBannerDrop
(Block block) protected LootTable.Builder
createBeeHiveDrop
(Block block) protected LootTable.Builder
createBeeNestDrop
(Block block) protected static LootTable.Builder
createCandleCakeDrops
(Block candleCakeBlock) protected LootTable.Builder
createCandleDrops
(Block candleBlock) protected LootTable.Builder
createCaveVinesDrop
(Block block) protected LootTable.Builder
createCopperOreDrops
(Block block) protected LootTable.Builder
createCropDrops
(Block cropBlock, Item grownCropItem, Item seedsItem, LootItemCondition.Builder dropGrownCropCondition) IfdropGrownCropCondition
fails (i.e.protected LootTable.Builder
createDoorTable
(Block doorBlock) protected LootTable.Builder
createDoublePlantShearsDrop
(Block sheared) protected LootTable.Builder
createDoublePlantWithSeedDrops
(Block block, Block sheared) protected LootTable.Builder
createGrassDrops
(Block block) protected LootTable.Builder
createLapisOreDrops
(Block block) 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.protected LootTable.Builder
createMangroveLeavesDrops
(Block block) protected LootTable.Builder
createMultifaceBlockDrops
(Block block, LootItemCondition.Builder builder) protected LootTable.Builder
createMushroomBlockDrop
(Block block, ItemLike item) protected LootTable.Builder
protected LootTable.Builder
createOakLeavesDrops
(Block oakLeavesBlock, Block saplingBlock, float... chances) Used for oak and dark oak, same as droppingWithChancesAndSticks but adding in apples.protected LootTable.Builder
createOreDrop
(Block block, Item item) protected LootTable.Builder
createPetalsDrops
(Block petalBlock) protected LootTable.Builder
protected LootTable.Builder
createRedstoneOreDrops
(Block block) protected static LootTable.Builder
createSelfDropDispatchTable
(Block block, LootItemCondition.Builder conditionBuilder, LootPoolEntryContainer.Builder<?> alternativeBuilder) If the condition fromconditionBuilder
succeeds, drops 1block
.protected LootTable.Builder
createShearsDispatchTable
(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined with Shears, drops 1block
.protected static LootTable.Builder
createShearsOnlyDrop
(ItemLike item) protected LootTable.Builder
createShulkerBoxDrop
(Block block) protected LootTable.Builder
createSilkTouchDispatchTable
(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined with Silk Touch, drops 1block
.protected LootTable.Builder
protected LootTable.Builder
createSilkTouchOrShearsDispatchTable
(Block block, LootPoolEntryContainer.Builder<?> builder) If the block is mined either with Silk Touch or Shears, drops 1block
.protected LootTable.Builder
createSingleItemTable
(ItemLike item, NumberProvider count) protected LootTable.Builder
createSingleItemTableWithSilkTouch
(Block block, ItemLike item) protected LootTable.Builder
createSingleItemTableWithSilkTouch
(Block block, ItemLike item, NumberProvider count) protected <T extends Comparable<T> & StringRepresentable>
LootTable.BuildercreateSinglePropConditionTable
(Block block, Property<T> property, T value) protected LootTable.Builder
createSlabItemTable
(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.Builder
protected LootItemCondition.Builder
protected void
protected void
dropPottedContents
(Block flowerPot) protected void
protected void
dropWhenSilkTouch
(Block block) protected abstract void
generate()
void
generate
(BiConsumer<ResourceKey<LootTable>, LootTable.Builder> output) private LootItemCondition.Builder
protected LootItemCondition.Builder
static LootTable.Builder
noDrop()
protected void
otherWhenSilkTouch
(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 fromconditionBuilder
succeeds, 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) IfdropGrownCropCondition
fails (i.e. crop is not ready), drops 1seedsItem
. IfdropGrownCropCondition
succeeds (i.e. crop is ready), drops 1grownCropItem
, and 0-3seedsItem
with fortune applied. -
createDoublePlantShearsDrop
-
createDoublePlantWithSeedDrops
-
createCandleDrops
-
createPetalsDrops
-
createCandleCakeDrops
-
noDrop
-
generate
protected abstract void generate() -
getKnownBlocks
-
generate
- Specified by:
generate
in interfaceLootTableSubProvider
-
addNetherVinesDropTable
-
createDoorTable
-
dropPottedContents
-
otherWhenSilkTouch
-
dropOther
-
dropWhenSilkTouch
-
dropSelf
-
add
-
add
-