Package net.minecraftforge.common
Class TierSortingRegistry
java.lang.Object
net.minecraftforge.common.TierSortingRegistry
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate static ResourceLocation
private static com.google.common.collect.Multimap<ResourceLocation,ResourceLocation>
private static boolean
private static ResourceLocation
private static org.apache.logging.log4j.Logger
private static String
private static SimpleChannel
private static com.google.common.collect.BiMap<ResourceLocation,Tier>
private static com.google.common.collect.Multimap<ResourceLocation,ResourceLocation>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) static boolean
static Tier
byName(ResourceLocation name)
Returns the tier associated with a name, if registered into the sorting system.static ResourceLocation
Returns the name associated with a tier, if the tier is registered into the sorting system.(package private) static PreparableReloadListener
Returns the list of tiers in the order defined by the dependencies.private static ResourceLocation
getTierName(Object entry)
getTiersLowerThan(Tier tier)
Helper to query all tiers that are lower than the given tierprivate static void
handle(TierSortingRegistry.SyncPacket packet, Supplier<NetworkEvent.Context> context)
(package private) static void
init()
static boolean
isCorrectTierForDrops(Tier tier, BlockState state)
Queries if a tier is high enough to be able to get drops for the given blockstate.private static boolean
isCorrectTierVanilla(Tier tier, BlockState state)
Fallback for when a tier isn't in the registry, copy of the logic inDiggerItem.isCorrectToolForDrops(net.minecraft.world.level.block.state.BlockState)
static boolean
isTierSorted(Tier tier)
Queries if a tier should be evaluated using the sorting system, by calling isCorrectTierForDropsprivate static void
private static void
processTier(Tier tier, ResourceLocation name, List<Object> afters, List<Object> befores)
private static void
private static TierSortingRegistry.SyncPacket
receive(FriendlyByteBuf buffer)
static Tier
registerTier(Tier tier, ResourceLocation name, List<Object> after, List<Object> before)
Registers a tier into the tier sorting registry.private static void
runInServerThreadIfPossible(it.unimi.dsi.fastutil.booleans.BooleanConsumer runnable)
private static void
setTierOrder(List<Tier> tierList)
private static void
private static void
syncToPlayer(ServerPlayer serverPlayer)
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
ITEM_TIER_ORDERING_JSON
-
hasCustomTiers
private static boolean hasCustomTiers -
tiers
-
edges
-
vanillaEdges
private static final com.google.common.collect.Multimap<ResourceLocation,ResourceLocation> vanillaEdges -
sortedTiers
-
sortedTiersUnmodifiable
-
CHANNEL_NAME
-
PROTOCOL_VERSION
- See Also:
- Constant Field Values
-
SYNC_CHANNEL
-
-
Constructor Details
-
TierSortingRegistry
public TierSortingRegistry()
-
-
Method Details
-
registerTier
public static Tier registerTier(Tier tier, ResourceLocation name, List<Object> after, List<Object> before)Registers a tier into the tier sorting registry.- Parameters:
tier
- The tier to registername
- The name to use internally for dependency resolutionafter
- List of tiers to place this tier after (the tiers in the list will be considered lesser tiers)before
- List of tiers to place this tier before (the tiers in the list will be considered better tiers)
-
getSortedTiers
Returns the list of tiers in the order defined by the dependencies. This list will remain valid- Returns:
- An unmodifiable list of tiers ordered lesser to greater
-
byName
Returns the tier associated with a name, if registered into the sorting system.- Parameters:
name
- The name to look up- Returns:
- The tier, or null if not registered
-
getName
Returns the name associated with a tier, if the tier is registered into the sorting system.- Parameters:
tier
- The tier to look up- Returns:
- The name for the tier, or null if not registered
-
isTierSorted
Queries if a tier should be evaluated using the sorting system, by calling isCorrectTierForDrops- Parameters:
tier
- The tier to query- Returns:
- True if isCorrectTierForDrops should be called for the tier
-
isCorrectTierForDrops
Queries if a tier is high enough to be able to get drops for the given blockstate.- Parameters:
tier
- The tier to look upstate
- The state to test against- Returns:
- True if the tier is good enough
-
getTiersLowerThan
Helper to query all tiers that are lower than the given tier- Parameters:
tier
- The tier- Returns:
- All the lower tiers
-
isCorrectTierVanilla
Fallback for when a tier isn't in the registry, copy of the logic inDiggerItem.isCorrectToolForDrops(net.minecraft.world.level.block.state.BlockState)
-
processTier
-
getTierName
-
allowVanilla
static boolean allowVanilla() -
init
static void init() -
getReloadListener
-
recalculateItemTiers
private static void recalculateItemTiers() -
setTierOrder
-
runInServerThreadIfPossible
private static void runInServerThreadIfPossible(it.unimi.dsi.fastutil.booleans.BooleanConsumer runnable) -
syncToAll
private static void syncToAll() -
playerLoggedIn
-
syncToPlayer
-
receive
-
handle
private static void handle(TierSortingRegistry.SyncPacket packet, Supplier<NetworkEvent.Context> context)
-