Record Class CommandResearchEffect
java.lang.Object
java.lang.Record
com.portingdeadmods.researchd.impl.research.effect.CommandResearchEffect
- All Implemented Interfaces:
ResearchEffect
public record CommandResearchEffect(String onUnlockCommand, String onLockCommand)
extends Record
implements ResearchEffect
Executes commands when a research is unlocked/locked.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocationstatic final Patternstatic final Stringstatic final Stringstatic final ResearchEffectSerializer<CommandResearchEffect> static final String -
Constructor Summary
ConstructorsConstructorDescriptionCommandResearchEffect(String onUnlockCommand, String onLockCommand) Creates an instance of aCommandResearchEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.resources.ResourceLocationid()voidonLock(net.minecraft.world.level.Level level, ResearchTeam team, net.minecraft.resources.ResourceKey<Research> research) Returns the value of theonLockCommandrecord component.voidonUnlock(net.minecraft.world.level.Level level, ResearchTeam team, net.minecraft.resources.ResourceKey<Research> research) Returns the value of theonUnlockCommandrecord component.final StringtoString()Returns a string representation of this record class.type()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
-
ID
public static final net.minecraft.resources.ResourceLocation ID -
PLAYER_NAME_PLACEHOLDER
- See Also:
-
TEAM_NAME_PLACEHOLDER
- See Also:
-
RESEARCH_ID_PLACEHOLDER
- See Also:
-
PLACEHOLDER_PATTERN
-
SERIALIZER
-
-
Constructor Details
-
CommandResearchEffect
Creates an instance of aCommandResearchEffectrecord class.- Parameters:
onUnlockCommand- the value for theonUnlockCommandrecord componentonLockCommand- the value for theonLockCommandrecord component
-
-
Method Details
-
onUnlock
public void onUnlock(net.minecraft.world.level.Level level, ResearchTeam team, net.minecraft.resources.ResourceKey<Research> research) - Specified by:
onUnlockin interfaceResearchEffect
-
onLock
public void onLock(net.minecraft.world.level.Level level, ResearchTeam team, net.minecraft.resources.ResourceKey<Research> research) Description copied from interface:ResearchEffectInverse ofResearchEffect.onUnlock(net.minecraft.world.level.Level, com.portingdeadmods.researchd.api.team.ResearchTeam, net.minecraft.resources.ResourceKey<com.portingdeadmods.researchd.api.research.Research>). Called when a previously-completed research is removed, and once per non-completed research at team-creation / datapack-reload time so the default "everything blocked" state is built up incrementally rather than from a separateinitDefaultpass.- Specified by:
onLockin interfaceResearchEffect
-
id
public net.minecraft.resources.ResourceLocation id()- Specified by:
idin interfaceResearchEffect
-
type
- Specified by:
typein interfaceResearchEffect
-
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). -
onUnlockCommand
Returns the value of theonUnlockCommandrecord component.- Returns:
- the value of the
onUnlockCommandrecord component
-
onLockCommand
Returns the value of theonLockCommandrecord component.- Returns:
- the value of the
onLockCommandrecord component
-