Record Class HolderSetItemAdvancedIngredient
java.lang.Object
java.lang.Record
com.petrolpark.core.recipe.ingredient.advanced.HolderSetItemAdvancedIngredient
- All Implemented Interfaces:
IAdvancedIngredient<net.minecraft.world.item.ItemStack>,IForcingItemAdvancedIngredient,ItemAdvancedIngredient,ITypelessAdvancedIngredient<net.minecraft.world.item.ItemStack>,Predicate<net.minecraft.world.item.ItemStack>
public record HolderSetItemAdvancedIngredient(net.minecraft.core.HolderSet<net.minecraft.world.item.Item> set)
extends Record
implements ItemAdvancedIngredient
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<HolderSetItemAdvancedIngredient> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, HolderSetItemAdvancedIngredient> Fields inherited from interface com.petrolpark.core.recipe.ingredient.advanced.ItemAdvancedIngredient
TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionHolderSetItemAdvancedIngredient(net.minecraft.core.HolderSet<net.minecraft.world.item.Item> set) Creates an instance of aHolderSetItemAdvancedIngredientrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToCounterDescription(Lang.IndentedTooltipBuilder description) voidaddToDescription(Lang.IndentedTooltipBuilder description) final booleanIndicates whether some other object is "equal to" this one.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.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.INamedAdvancedIngredientType<net.minecraft.world.item.ItemStack> getType()final inthashCode()Returns a hash code value for this object.net.minecraft.core.HolderSet<net.minecraft.world.item.Item> set()Returns the value of thesetrecord component.booleantest(net.minecraft.world.item.ItemStack 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.ItemAdvancedIngredient
forbidLootItemFunction, forceLootItemFunction, translate, translateInverse, translateSimpleMethods inherited from interface com.petrolpark.core.recipe.ingredient.advanced.ITypelessAdvancedIngredient
checkedCast, modifyCounterExamples, modifyExamples, streamCounterExamples, streamExamples
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,HolderSetItemAdvancedIngredient> STREAM_CODEC
-
-
Constructor Details
-
HolderSetItemAdvancedIngredient
public HolderSetItemAdvancedIngredient(net.minecraft.core.HolderSet<net.minecraft.world.item.Item> set) Creates an instance of aHolderSetItemAdvancedIngredientrecord class.- Parameters:
set- the value for thesetrecord component
-
-
Method Details
-
test
public boolean test(net.minecraft.world.item.ItemStack stack) - Specified by:
testin interfaceItemAdvancedIngredient- Specified by:
testin interfacePredicate<net.minecraft.world.item.ItemStack>
-
addToDescription
- Specified by:
addToDescriptionin interfaceITypelessAdvancedIngredient<net.minecraft.world.item.ItemStack>
-
addToCounterDescription
- Specified by:
addToCounterDescriptionin interfaceITypelessAdvancedIngredient<net.minecraft.world.item.ItemStack>
-
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- Specified by:
forceTradeListingin interfaceItemAdvancedIngredient- 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- Specified by:
forbidTradeListingin interfaceItemAdvancedIngredient- 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.minecraft.world.item.ItemStack>- Specified by:
getTypein interfaceItemAdvancedIngredient
-
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). -
set
public net.minecraft.core.HolderSet<net.minecraft.world.item.Item> set()Returns the value of thesetrecord component.- Returns:
- the value of the
setrecord component
-