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
FieldsModifier and TypeFieldDescriptionstatic final Supplier<com.mojang.serialization.MapCodec<SimpleChestModifierHandler>> Fields inherited from class net.neoforged.neoforge.common.loot.LootModifier
conditions, priorityFields inherited from interface net.neoforged.neoforge.common.loot.IGlobalLootModifier
CONDITIONAL_CODEC, DEFAULT_PRIORITY, DIRECT_CODEC, LOOT_CONDITIONS_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionSimpleChestModifierHandler(net.minecraft.world.level.storage.loot.predicates.LootItemCondition[] itemConditions, int minQuantity, int maxQuantity, float rollChance, net.minecraft.world.item.ItemStackTemplate item) Create a simple chest modifier.SimpleChestModifierHandler(net.minecraft.world.level.storage.loot.predicates.LootItemCondition[] itemConditions, int priority, int minQuantity, int maxQuantity, float rollChance, net.minecraft.world.item.ItemStackTemplate item, int maxEnchantLevels, boolean allowTreasure) Create a simple chest modifier. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<? extends net.neoforged.neoforge.common.loot.IGlobalLootModifier> codec()protected 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, priority
-
Field Details
-
CODEC
-
-
Constructor Details
-
SimpleChestModifierHandler
public SimpleChestModifierHandler(net.minecraft.world.level.storage.loot.predicates.LootItemCondition[] itemConditions, int minQuantity, int maxQuantity, float rollChance, net.minecraft.world.item.ItemStackTemplate item) 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 poolminQuantity- The minimum quantity of the item to add to the loot poolmaxQuantity- The maximum quantity of the item to add to the loot poolrollChance- The chance that the item will be added to the loot poolitem- The item to add to the loot pool
-
SimpleChestModifierHandler
public SimpleChestModifierHandler(net.minecraft.world.level.storage.loot.predicates.LootItemCondition[] itemConditions, int priority, int minQuantity, int maxQuantity, float rollChance, net.minecraft.world.item.ItemStackTemplate item, 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 poolminQuantity- The minimum quantity of the item to add to the loot poolmaxQuantity- The maximum quantity of the item to add to the loot poolrollChance- The chance that the item will be added to the loot poolitem- The item to add to the loot poolmaxEnchantLevels- The maximum number of enchantment levels to apply to the itemallowTreasure- Whether to allow treasure enchantments
-
-
Method Details
-
doApply
protected 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:
doApplyin classnet.neoforged.neoforge.common.loot.LootModifier
-
codec
public com.mojang.serialization.MapCodec<? extends net.neoforged.neoforge.common.loot.IGlobalLootModifier> codec()
-