Package de.z0rdak.yawp.api
Class FlagRegister
java.lang.Object
de.z0rdak.yawp.api.FlagRegister
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flagstatic final Flag -
Method Summary
Modifier and TypeMethodDescriptionstatic FlagRetrieves a Flag by its string identifier.static @Nullable FlaggetFlag(net.minecraft.resources.ResourceLocation rl) Retrieves a Flag by its ResourceLocation, or null if not found.Gets a list of all registered flag names as strings.getFlagOptional(net.minecraft.resources.ResourceLocation rl) Retrieves an Optional containing the Flag if it exists.getFlags()Retrieves a set of all registered Flags.getFlagsByFrequency(FlagFrequency frequency) Retrieves all registered flags that match a given frequency.Retrieves all flags that match a given category tag.static booleanhasPlayerTag(Flag flag) Checks if a given flag has the PLAYER tag.static booleanhasPlayerTag(IFlag flag) Checks if a given flag has the PLAYER tag based on its identifier.static booleanisFlagRegistered(net.minecraft.resources.ResourceLocation rl) Checks if a flag is registered based on its ResourceLocation.static booleanisRegistered(String flagIdentifier) Checks if a flag is registered based on its string identifier.static booleanChecks if two Flag instances represent the same flag.static booleanChecks if the given flag ID matches the specified Flag.static booleanChecks if the given ResourceLocation matches the specified Flag.static booleanmatchesCategory(Flag flag, Set<String> tags) Determines if a flag belongs to a given set of category tags.static booleanregisterFlag(@NotNull String modId, @NotNull String flagId, @NotNull FlagMetaInfo flagMetaInfo) Registers a flag in the internal flag registry using the modId of the registering mod and a flagId.static booleanregisterFlag(@NotNull net.minecraft.resources.ResourceLocation flagRl, @NotNull FlagMetaInfo flagMetaInfo) Registers a flag in the internal flag registry using aResourceLocationandFlagMetaInfo.
-
Field Details
-
PLAYER_BREED_ANIMAL
-
PLAYER_MOUNT
-
PLAYER_TAME_ANIMAL
-
PLAYER_UNMOUNTING
-
PLAYER_STRIP_WOOD
-
PLAYER_BREAK_BLOCKS
-
PLAYER_USE_CONTAINER
-
PLAYER_GAIN_LOOT
-
PLAYER_USE_CHEST_ACCESS
-
PLAYER_ENTER_LEVEL
-
PLAYER_USE_COMMANDS
-
PLAYER_TILL
-
PLAYER_IGNITE_EXPLOSIVES
-
PLAYER_HURT
-
PLAYER_DROP_ITEM
-
PLAYER_PICKUP_ITEM
-
PLAYER_APPLY_KNOCKBACK
-
PLAYER_KNOCKBACK
-
PLAYER_GAIN_LEVEL
-
PLAYER_WALKER_FREEZE
-
PLAYER_FALL_DAMAGE
-
PLAYER_FIRE_BOW
-
PLAYER_MELEE_ANIMALS
-
PLAYER_MELEE_MONSTERS
-
PLAYER_MELEE_PLAYERS
-
PLAYER_MELEE_VILLAGERS
-
PLAYER_MELEE_WANDERING_TRADER
-
PLAYER_FLIGHT
-
PLAYER_PVP
-
PLAYER_EDIT_SIGNS
-
PLAYER_PLACE_BLOCKS
-
PLAYER_PLACE_FLUIDS
-
PLAYER_SCOOP_FLUIDS
-
PLAYER_CHAT
-
PLAYER_SET_SPAWN
-
PLAYER_SHOVEL_PATH
-
PLAYER_CREATE_PORTAL
-
PLAYER_TOOL_SECONDARY
-
PLAYER_TRAMPLE_FARMLAND
-
PLAYER_USE_BLOCKS
-
PLAYER_USE_BONEMEAL
-
PLAYER_USE_ELYTRA
-
PLAYER_USE_ENDERPEARL
-
PLAYER_ENDERPEARL_AWAY
-
PLAYER_INTERACT
-
PLAYER_USE_ITEMS
-
PLAYER_SLEEP
-
PLAYER_ENTER_PORTAL
-
PLAYER_KEEP_XP
-
PLAYER_KEEP_INV
-
PLAYER_APPLY_HUNGER
-
PLAYER_DROP_XP
-
PLAYER_GAIN_XP
-
PLAYER_PICKUP_XP
-
DRAGON_BLOCK_PROT
-
DROP_LOOT_ALL
-
ENDERMAN_GRIEFING
-
ENDERMAN_TELEPORT
-
EXPLOSION_BLOCK
-
EXPLOSION_ENTITY
-
EXPLOSION_CREEPER_BLOCK
-
EXPLOSION_CREEPER_ENTITY
-
TRAMPLE_FARMLAND
-
FALL_DAMAGE
-
FALL_DAMAGE_ANIMALS
-
FALL_DAMAGE_MONSTERS
-
SHULKER_TELEPORT
-
FALL_DAMAGE_VILLAGERS
-
LAVA_FLOW
-
LIGHTNING_PROT
-
FLUID_FLOW
-
LEAF_DECAY
-
FIRE_TICK
-
NO_ITEM_DESPAWN
-
MOB_GRIEFING
-
SNOW_FALL
-
SNOW_MELTING
-
SPAWNING_ALL
-
SPAWNING_ANIMAL
-
SPAWNING_GOLEM
-
SPAWNING_MONSTER
-
SPAWNING_SLIME
-
SPAWNING_TRADER
-
SPAWNING_VILLAGER
-
SPAWNING_XP
-
USE_PORTAL
-
USE_PORTAL_ANIMALS
-
USE_PORTAL_ITEMS
-
USE_PORTAL_MINECARTS
-
USE_PORTAL_MONSTERS
-
USE_PORTAL_VILLAGERS
-
WATER_FLOW
-
WITHER_BLOCK_PROT
-
XP_DROP_ALL
-
XP_DROP_MONSTER
-
ZOMBIE_DOOR_PROT
-
-
Method Details
-
isSame
Checks if the given flag ID matches the specified Flag.- Parameters:
flagId- The string representation of the flag ID.flag- The flag to compare against.- Returns:
- True if the flag ID matches the flag's ResourceLocation, false otherwise.
-
isSame
Checks if two Flag instances represent the same flag.- Parameters:
left- The first flag.right- The second flag.- Returns:
- True if both flags have the same ResourceLocation, false otherwise.
-
isSame
Checks if the given ResourceLocation matches the specified Flag.- Parameters:
flagId- The ResourceLocation of the flag.flag- The flag to compare against.- Returns:
- True if the ResourceLocation matches the flag's ResourceLocation, false otherwise.
-
registerFlag
public static boolean registerFlag(@NotNull @NotNull net.minecraft.resources.ResourceLocation flagRl, @NotNull @NotNull FlagMetaInfo flagMetaInfo) Registers a flag in the internal flag registry using aResourceLocationandFlagMetaInfo. If a flag with the same resource location already exists, registration is skipped.- Parameters:
flagRl- The unique resource location of the flag.flagMetaInfo- The metadata associated with the flag.- Returns:
trueif the flag was successfully registered,falseif it was already registered.
-
registerFlag
public static boolean registerFlag(@NotNull @NotNull String modId, @NotNull @NotNull String flagId, @NotNull @NotNull FlagMetaInfo flagMetaInfo) Registers a flag in the internal flag registry using the modId of the registering mod and a flagId. If a flag with the same resource location already exists, registration is skipped.- Parameters:
modId- The namespace of the mod defining the flag.flagId- The unique identifier of the flag within the mod's namespace.flagMetaInfo- The metadata associated with the flag.- Returns:
trueif the flag was successfully registered,falseif it was already registered.
-
getFlagsByFrequency
Retrieves all registered flags that match a given frequency.- Parameters:
frequency- The frequency to filter flags by.- Returns:
- A set of flags that have the specified frequency.
-
isFlagRegistered
public static boolean isFlagRegistered(net.minecraft.resources.ResourceLocation rl) Checks if a flag is registered based on its ResourceLocation.- Parameters:
rl- The ResourceLocation of the flag.- Returns:
- True if the flag is registered, false otherwise.
-
isRegistered
Checks if a flag is registered based on its string identifier.- Parameters:
flagIdentifier- The string representation of the flag.- Returns:
- True if the flag is registered, false otherwise.
-
byId
Retrieves a Flag by its string identifier.- Parameters:
flagIdentifier- The string representation of the flag.- Returns:
- The corresponding Flag.
- Throws:
IllegalArgumentException- If the flag is not registered.
-
getFlagOptional
Retrieves an Optional containing the Flag if it exists.- Parameters:
rl- The ResourceLocation of the flag.- Returns:
- An Optional containing the flag if registered, otherwise empty.
-
getFlag
Retrieves a Flag by its ResourceLocation, or null if not found.- Parameters:
rl- The ResourceLocation of the flag.- Returns:
- The corresponding Flag if registered, otherwise null.
-
getFlagNames
Gets a list of all registered flag names as strings.- Returns:
- A list of flag names.
-
getFlags
Retrieves a set of all registered Flags.- Returns:
- A set containing all registered Flags.
-
getFlagsMatchingTag
Retrieves all flags that match a given category tag.- Parameters:
tag- The category tag to filter flags by.- Returns:
- A set of flags that match the given tag.
-
hasPlayerTag
Checks if a given flag has the PLAYER tag based on its identifier.- Parameters:
flag- The flag to check.- Returns:
- True if the flag has the PLAYER tag, false otherwise.
-
hasPlayerTag
Checks if a given flag has the PLAYER tag.- Parameters:
flag- The flag to check.- Returns:
- True if the flag has the PLAYER tag, false otherwise.
-
matchesCategory
Determines if a flag belongs to a given set of category tags.- Parameters:
flag- The flag to check.tags- The set of category tags.- Returns:
- True if the flag has at least one of the given tags, false otherwise.
-