Record Class UnlockItemEffect
java.lang.Object
java.lang.Record
com.portingdeadmods.researchd.impl.research.effect.UnlockItemEffect
- All Implemented Interfaces:
ResearchEffect
public record UnlockItemEffect(Optional<net.minecraft.world.item.ItemStack> icon, Optional<String> name, net.minecraft.resources.ResourceLocation item)
extends Record
implements ResearchEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocationstatic final ResearchEffectSerializer<UnlockItemEffect> -
Constructor Summary
ConstructorsConstructorDescriptionUnlockItemEffect(Optional<net.minecraft.world.item.ItemStack> icon, Optional<String> name, net.minecraft.resources.ResourceLocation item) Creates an instance of aUnlockItemEffectrecord class.UnlockItemEffect(net.minecraft.resources.ResourceLocation item) UnlockItemEffect(net.minecraft.world.item.Item item) UnlockItemEffect(net.minecraft.world.item.ItemStack icon, String name, net.minecraft.resources.ResourceLocation item) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.item.ItemStacknet.minecraft.world.item.ItemgetItem()net.minecraft.resources.ResourceKey<net.minecraft.world.item.Item> Set<net.minecraft.world.item.crafting.RecipeHolder<?>> getRecipes(net.minecraft.world.level.Level level) final inthashCode()Returns a hash code value for this object.Optional<net.minecraft.world.item.ItemStack> icon()Returns the value of theiconrecord component.net.minecraft.resources.ResourceLocationid()net.minecraft.resources.ResourceLocationitem()Returns the value of theitemrecord component.name()Returns the value of thenamerecord component.voidonUnlock(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.resources.ResourceKey<Research> research) 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.portingdeadmods.researchd.api.research.effects.ResearchEffect
getTranslation
-
Field Details
-
SERIALIZER
-
ID
public static final net.minecraft.resources.ResourceLocation ID
-
-
Constructor Details
-
UnlockItemEffect
public UnlockItemEffect(net.minecraft.world.item.ItemStack icon, String name, net.minecraft.resources.ResourceLocation item) -
UnlockItemEffect
public UnlockItemEffect(net.minecraft.resources.ResourceLocation item) -
UnlockItemEffect
public UnlockItemEffect(net.minecraft.world.item.Item item) -
UnlockItemEffect
public UnlockItemEffect(Optional<net.minecraft.world.item.ItemStack> icon, Optional<String> name, net.minecraft.resources.ResourceLocation item) Creates an instance of aUnlockItemEffectrecord class.- Parameters:
icon- the value for theiconrecord componentname- the value for thenamerecord componentitem- the value for theitemrecord component
-
-
Method Details
-
onUnlock
public void onUnlock(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.resources.ResourceKey<Research> research) - Specified by:
onUnlockin interfaceResearchEffect
-
id
public net.minecraft.resources.ResourceLocation id()- Specified by:
idin interfaceResearchEffect
-
getItem
public net.minecraft.world.item.Item getItem() -
getDisplayStack
public net.minecraft.world.item.ItemStack getDisplayStack() -
getRecipes
public Set<net.minecraft.world.item.crafting.RecipeHolder<?>> getRecipes(net.minecraft.world.level.Level level) -
getItemKey
public net.minecraft.resources.ResourceKey<net.minecraft.world.item.Item> getItemKey() -
getSerializer
- Specified by:
getSerializerin interfaceResearchEffect
-
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). -
icon
Returns the value of theiconrecord component.- Returns:
- the value of the
iconrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
item
public net.minecraft.resources.ResourceLocation item()Returns the value of theitemrecord component.- Returns:
- the value of the
itemrecord component
-