Class SimpleChestModifierHandler

java.lang.Object
net.neoforged.neoforge.common.loot.LootModifier
tech.anonymoushacker1279.immersiveweapons.world.level.loot.SimpleChestModifierHandler
All Implemented Interfaces:
net.neoforged.neoforge.common.loot.IGlobalLootModifier

public class SimpleChestModifierHandler extends net.neoforged.neoforge.common.loot.LootModifier
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Supplier<com.mojang.serialization.Codec<SimpleChestModifierHandler>>
     

    Fields inherited from class net.neoforged.neoforge.common.loot.LootModifier

    conditions

    Fields inherited from interface net.neoforged.neoforge.common.loot.IGlobalLootModifier

    CONDITIONAL_CODEC, DIRECT_CODEC, LOOT_CONDITIONS_CODEC
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimpleChestModifierHandler(net.minecraft.world.level.storage.loot.predicates.LootItemCondition[] itemConditions, int minQuantity, int maxQuantity, float rollChance, net.minecraft.world.item.ItemStack itemStack)
    Create a simple chest modifier.
    SimpleChestModifierHandler(net.minecraft.world.level.storage.loot.predicates.LootItemCondition[] itemConditions, int minQuantity, int maxQuantity, float rollChance, net.minecraft.world.item.ItemStack itemStack, int maxEnchantLevels, boolean allowTreasure)
    Create a simple chest modifier.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.serialization.Codec<? extends net.neoforged.neoforge.common.loot.IGlobalLootModifier>
     
    protected @NotNull it.unimi.dsi.fastutil.objects.ObjectArrayList<net.minecraft.world.item.ItemStack>
    doApply(it.unimi.dsi.fastutil.objects.ObjectArrayList<net.minecraft.world.item.ItemStack> generatedLoot, net.minecraft.world.level.storage.loot.LootContext context)
     

    Methods inherited from class net.neoforged.neoforge.common.loot.LootModifier

    apply, codecStart

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • SimpleChestModifierHandler

      public SimpleChestModifierHandler(net.minecraft.world.level.storage.loot.predicates.LootItemCondition[] itemConditions, int minQuantity, int maxQuantity, float rollChance, net.minecraft.world.item.ItemStack itemStack)
      Create a simple chest modifier. This will add the specified item to the loot pool if the conditions are met.
      Parameters:
      itemConditions - The conditions that must be met for the item to be added to the loot pool
      minQuantity - The minimum quantity of the item to add to the loot pool
      maxQuantity - The maximum quantity of the item to add to the loot pool
      rollChance - The chance that the item will be added to the loot pool
      itemStack - The item to add to the loot pool
    • SimpleChestModifierHandler

      public SimpleChestModifierHandler(net.minecraft.world.level.storage.loot.predicates.LootItemCondition[] itemConditions, int minQuantity, int maxQuantity, float rollChance, net.minecraft.world.item.ItemStack itemStack, int maxEnchantLevels, boolean allowTreasure)
      Create a simple chest modifier. This will add the specified item to the loot pool if the conditions are met. The item will be randomly enchanted given the specified max enchantment levels.
      Parameters:
      itemConditions - The conditions that must be met for the item to be added to the loot pool
      minQuantity - The minimum quantity of the item to add to the loot pool
      maxQuantity - The maximum quantity of the item to add to the loot pool
      rollChance - The chance that the item will be added to the loot pool
      itemStack - The item to add to the loot pool
      maxEnchantLevels - The maximum number of enchantment levels to apply to the item
      allowTreasure - Whether to allow treasure enchantments
  • Method Details

    • doApply

      @NotNull protected @NotNull it.unimi.dsi.fastutil.objects.ObjectArrayList<net.minecraft.world.item.ItemStack> doApply(it.unimi.dsi.fastutil.objects.ObjectArrayList<net.minecraft.world.item.ItemStack> generatedLoot, net.minecraft.world.level.storage.loot.LootContext context)
      Specified by:
      doApply in class net.neoforged.neoforge.common.loot.LootModifier
    • codec

      public com.mojang.serialization.Codec<? extends net.neoforged.neoforge.common.loot.IGlobalLootModifier> codec()