Class LootModifier

    • Field Detail

      • combinedConditions

        private final java.util.function.Predicate<LootContext> combinedConditions
    • Constructor Detail

      • LootModifier

        protected LootModifier​(ILootCondition[] conditionsIn)
        Constructs a LootModifier.
        Parameters:
        conditionsIn - the ILootConditions that need to be matched before the loot is modified.
    • Method Detail

      • apply

        @Nonnull
        public final java.util.List<ItemStack> apply​(java.util.List<ItemStack> generatedLoot,
                                                     LootContext context)
        Description copied from interface: IGlobalLootModifier
        Applies the modifier to the list of generated loot. This function needs to be responsible for checking ILootConditions as well.
        Specified by:
        apply in interface IGlobalLootModifier
        Parameters:
        generatedLoot - the list of ItemStacks that will be dropped, generated by loot tables
        context - the LootContext, identical to what is passed to loot tables
        Returns:
        modified loot drops
      • doApply

        @Nonnull
        protected abstract java.util.List<ItemStack> doApply​(java.util.List<ItemStack> generatedLoot,
                                                             LootContext context)
        Applies the modifier to the generated loot (all loot conditions have already been checked and have returned true).
        Parameters:
        generatedLoot - the list of ItemStacks that will be dropped, generated by loot tables
        context - the LootContext, identical to what is passed to loot tables
        Returns:
        modified loot drops