Record Class ContaminatedAdvancedIngredient
java.lang.Object
java.lang.Record
com.petrolpark.core.recipe.ingredient.advanced.ContaminatedAdvancedIngredient
- All Implemented Interfaces:
IAdvancedIngredient<net.neoforged.neoforge.common.MutableDataComponentHolder>,IForcingItemAdvancedIngredient,ITypelessAdvancedIngredient<net.neoforged.neoforge.common.MutableDataComponentHolder>,Predicate<net.neoforged.neoforge.common.MutableDataComponentHolder>
public record ContaminatedAdvancedIngredient(net.minecraft.core.Holder<Contaminant> contaminant)
extends Record
implements IAdvancedIngredient<net.neoforged.neoforge.common.MutableDataComponentHolder>, IForcingItemAdvancedIngredient
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ContaminatedAdvancedIngredient> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, ContaminatedAdvancedIngredient> static final IAdvancedIngredientType<net.neoforged.neoforge.common.MutableDataComponentHolder> -
Constructor Summary
ConstructorsConstructorDescriptionContaminatedAdvancedIngredient(net.minecraft.core.Holder<Contaminant> contaminant) Creates an instance of aContaminatedAdvancedIngredientrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToCounterDescription(Lang.IndentedTooltipBuilder description) voidaddToDescription(Lang.IndentedTooltipBuilder description) net.minecraft.core.Holder<Contaminant> Returns the value of thecontaminantrecord component.final booleanIndicates whether some other object is "equal to" this one.Optional<net.minecraft.world.item.ItemStack> forbidLootItemFunction(net.minecraft.world.level.storage.loot.functions.LootItemFunction function, net.minecraft.world.level.storage.loot.LootContext context, net.minecraft.world.item.ItemStack stack) Attempt to force the output of the givenLootItemFunctionso it does notconformto thisIAdvancedIngredient.Optional<net.minecraft.world.item.trading.MerchantOffer> forbidTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing tradeListing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Attempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputdoes notconformto thisIAdvancedIngredient.Optional<net.minecraft.world.item.ItemStack> forceLootItemFunction(net.minecraft.world.level.storage.loot.functions.LootItemFunction function, net.minecraft.world.level.storage.loot.LootContext context, net.minecraft.world.item.ItemStack stack) Optional<net.minecraft.world.item.trading.MerchantOffer> forceTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing tradeListing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Attempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputconformsto thisIAdvancedIngredient.IAdvancedIngredientType<net.neoforged.neoforge.common.MutableDataComponentHolder> getType()final inthashCode()Returns a hash code value for this object.Stream<net.neoforged.neoforge.common.MutableDataComponentHolder> modifyCounterExamples(Stream<net.neoforged.neoforge.common.MutableDataComponentHolder> counterExampleStacks) Modify an example stack so it does notfulfillthisIAdvancedIngredient.Stream<net.neoforged.neoforge.common.MutableDataComponentHolder> modifyExamples(Stream<net.neoforged.neoforge.common.MutableDataComponentHolder> exampleStacks) Modify an example stack so itfulfillthisIAdvancedIngredient.booleantest(net.neoforged.neoforge.common.MutableDataComponentHolder stack) final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.petrolpark.core.recipe.ingredient.advanced.IAdvancedIngredient
simplifyMethods inherited from interface com.petrolpark.core.recipe.ingredient.advanced.ITypelessAdvancedIngredient
checkedCast, streamCounterExamples, streamExamples
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,ContaminatedAdvancedIngredient> STREAM_CODEC -
TYPE
public static final IAdvancedIngredientType<net.neoforged.neoforge.common.MutableDataComponentHolder> TYPE
-
-
Constructor Details
-
ContaminatedAdvancedIngredient
Creates an instance of aContaminatedAdvancedIngredientrecord class.- Parameters:
contaminant- the value for thecontaminantrecord component
-
-
Method Details
-
test
public boolean test(net.neoforged.neoforge.common.MutableDataComponentHolder stack) -
modifyExamples
public Stream<net.neoforged.neoforge.common.MutableDataComponentHolder> modifyExamples(Stream<net.neoforged.neoforge.common.MutableDataComponentHolder> exampleStacks) Description copied from interface:ITypelessAdvancedIngredientModify an example stack so itfulfillthisIAdvancedIngredient.- Specified by:
modifyExamplesin interfaceITypelessAdvancedIngredient<net.neoforged.neoforge.common.MutableDataComponentHolder>- Parameters:
exampleStacks- May be modified- Returns:
- A stack fulfilling this Ingredient, possibly the same object reference, or
nullif that stack can never fulfill this Ingredient
-
modifyCounterExamples
public Stream<net.neoforged.neoforge.common.MutableDataComponentHolder> modifyCounterExamples(Stream<net.neoforged.neoforge.common.MutableDataComponentHolder> counterExampleStacks) Description copied from interface:ITypelessAdvancedIngredientModify an example stack so it does notfulfillthisIAdvancedIngredient.- Specified by:
modifyCounterExamplesin interfaceITypelessAdvancedIngredient<net.neoforged.neoforge.common.MutableDataComponentHolder>- Parameters:
counterExampleStacks- May be modified- Returns:
- A stack not fulfilling this Ingredient, possibly the same object reference, or
nullif that stack always fulfills this Ingredient
-
addToDescription
- Specified by:
addToDescriptionin interfaceITypelessAdvancedIngredient<net.neoforged.neoforge.common.MutableDataComponentHolder>
-
addToCounterDescription
- Specified by:
addToCounterDescriptionin interfaceITypelessAdvancedIngredient<net.neoforged.neoforge.common.MutableDataComponentHolder>
-
forceLootItemFunction
@Nonnull public Optional<net.minecraft.world.item.ItemStack> forceLootItemFunction(net.minecraft.world.level.storage.loot.functions.LootItemFunction function, net.minecraft.world.level.storage.loot.LootContext context, net.minecraft.world.item.ItemStack stack) Description copied from interface:IForcingItemAdvancedIngredientAttempt to force the output of the givenLootItemFunctiontoconformto thisIAdvancedIngredient. This should not return an ItemStack which could not have been generated by theLootItemFunctionnaturally. It is not guaranteed that the returned ItemStack (if there is one) willconform, but this method should make a best effort.- Specified by:
forceLootItemFunctionin interfaceIForcingItemAdvancedIngredient- Parameters:
function- TheLootItemFunctionbeing called. This will never be aSequenceFunction, as those are unpacked automatically. Also, if it is aLootItemConditionalFunction, then it will have already passed all conditions by the time this method is called.context-stack- The ItemStack to which theLootItemFunctionis being applied- Returns:
- Non-
nullOptional, filled if an ItemStack could be generated matching thisIAdvancedIngredient, or empty if we could not force the output of theLootItemFunctionsuccessfully and it should be called as normal.
-
forbidLootItemFunction
@Nonnull public Optional<net.minecraft.world.item.ItemStack> forbidLootItemFunction(net.minecraft.world.level.storage.loot.functions.LootItemFunction function, net.minecraft.world.level.storage.loot.LootContext context, net.minecraft.world.item.ItemStack stack) Description copied from interface:IForcingItemAdvancedIngredientAttempt to force the output of the givenLootItemFunctionso it does notconformto thisIAdvancedIngredient. This should not return an ItemStack which could not have been generated by theLootItemFunctionnaturally. It is not guaranteed that the returned ItemStack (if there is one) won'tconform, but this method should make a best effort.- Specified by:
forbidLootItemFunctionin interfaceIForcingItemAdvancedIngredient- Parameters:
function- TheLootItemFunctionbeing called. This will never be aSequenceFunction, as those are unpacked automatically. Also, if it is aLootItemConditionalFunction, then it will have already passed all conditions by the time this method is called.context-stack- The ItemStack to which theLootItemFunctionis being applied- Returns:
- Non-
nullOptional, filled if an ItemStack could be generated not matching thisIAdvancedIngredient, or empty if we could not force the output of theLootItemFunctionsuccessfully and it should be called as normal.
-
forceTradeListing
@Nullable public Optional<net.minecraft.world.item.trading.MerchantOffer> forceTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing tradeListing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Description copied from interface:IForcingItemAdvancedIngredientAttempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputconformsto thisIAdvancedIngredient. This should not generate aMerchantOfferwhich could not have been generated by theVillagerTrades.ItemListingnaturally. It is not guaranteed that the result of the returnedMerchantOffer(if there is one) willconform, but this method should make a best effort.- Specified by:
forceTradeListingin interfaceIForcingItemAdvancedIngredient- Parameters:
tradeListing-trader-random-- Returns:
nullif thisIAdvancedIngredientcould not generate aMerchantOfferwith a matching result, an empty Optional if theVillagerTrades.ItemListingshould generate noMerchantOfferat all (i.e.returnnull), or a filled Optional containing aMerchantOfferwith a matching result.
-
forbidTradeListing
@Nullable public Optional<net.minecraft.world.item.trading.MerchantOffer> forbidTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing tradeListing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Description copied from interface:IForcingItemAdvancedIngredientAttempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputdoes notconformto thisIAdvancedIngredient. This should not generate aMerchantOfferwhich could not have been generated by theVillagerTrades.ItemListingnaturally. It is not guaranteed that the result of the returnedMerchantOffer(if there is one) won'tconform, but this method should make a best effort.- Specified by:
forbidTradeListingin interfaceIForcingItemAdvancedIngredient- Parameters:
tradeListing-trader-random-- Returns:
nullif thisIAdvancedIngredientcould not generate aMerchantOfferwith a non-matching result, an empty Optional if theVillagerTrades.ItemListingshould generate noMerchantOfferat all (i.e.returnnull), or a filled Optional containing aMerchantOfferwith a non-matching result.
-
getType
- Specified by:
getTypein interfaceIAdvancedIngredient<net.neoforged.neoforge.common.MutableDataComponentHolder>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
contaminant
Returns the value of thecontaminantrecord component.- Returns:
- the value of the
contaminantrecord component
-