Skip to content
petrolpark edited this page Mar 29, 2026 · 6 revisions

Teams are convenient ways to refer to collections of Players. They are separate from, but interact with, Vanilla's Scoreboard Teams: the Library does not provide a way to create, add Players to or remove Players from Teams (this also distinguishes them from FTB Teams, for example). Unlike Scoreboard Teams, Players can belong to multiple Teams. Information (specifically Data Components) can be stored per Team.

The motivation for this system is to allow Players to share progress through some upcoming Petrolpark mods.

Accessing Teams

References to Teams are stored as ITeam.Provider objects (non-unique, many instances may exist for the same Team). These provide a Team object (unique, one instance per Team) when passed a Level. Unlike ITeams, ITeam.Providers can be serialized, for example as the petrolpark:team Data Component.

All the Teams of which a Player is a member can be accessed with the static method ITeam.streamAll(Player).

The Library provides interfaces allowing Players to choose a Team of which they are a member and bind it to an ItemStack (ITeamBoundItem) or Block Entity (ITeamBoundBlockEntity). Clicking with the Item (or calling an equivalent method on the Block Entity) brings up a menu that allows them to select a Team, a reference to which is then stored as a ITeam.Provider. This Team (and its Data Components) can then be conveniently accessed through the Item (or Block Entity), by any Players which are a member of the selected Team.

Built-in Implementations

Single-Player Teams

All Players, by default, belong to a Team that contains only themselves.

Scoreboard Teams

Vanilla Scoreboard Teams count as (Petrolpark) Teams. Like for all (Petrolpark) Teams, Data Components can be stored per Scoreboard Teams.

Custom Implementations

You must extend ITeam and ITeam.Provider, the latter of which has a ITeam.ProviderType "Serializer Type" object (like used for Number Providers, Loot Table entries etc.) that must be registered to the petrolpark:team_provider_types registry. ITeam.Provider must contain enough information to uniquely identify the Team.

You must also manually store Teams' Data Components. Obviously the built-in implementations are a good indication of how this should be done.

To let the game know if a Player is a member of your custom Team implementation, subscribe to GatherTeamProvidersEvent and add all ITeam.Providers of your custom implementation that refer to Teams of which the Player is a member.

Teams in Data Contexts

Teams can be accessed in "data" contexts (e.g. Advancements, Loot Tables, Shops). The Library adds a Loot Context Param, petrolpark:team, which is an ITeam object, which is available in certain data contexts (mainly Shops). Information about Teams can be accessed with Team Number Providers.

API Reference

Flags than can be applied to Item Stacks and other objects and will propagate through crafting

Timers that can be attached to Item Stacks to modify them after a given time, no matter what Inventory they are in

A way for mods to detect groupings of Players and store information on these groupings

Manipulation of Loot Table randomness and other RNG to give desired Items

Additional inventory and hotbar slots for the Player

Blocks and Items that have variants craftable from any mod's wood

Loot and Data

Data-driven modifications to existing Loot Tables with greater versatility than NeoForge Global Loot Modifiers

Data-driven changes to the world (give Items, XP, unlock Villager Trades)

Levelable "Shops" shared between Teams giving Rewards for randomly-generated Item requests

Additional implementations of vanilla's Number Providers used in Loot Tables and Advancements

Recipes

Extension of NeoForge Ingredients to include descriptions and Loot Table forcing

Work with automatically-detected "compression" Recipes (e.g. Nuggets <-> Ingots <-> Blocks)

Recycling (page under construction)

Balanced and versatile "uncrafting" API

Gating Recipes for vanilla and modded Items behind Item unlocks

Changelogs

1.3.1, 1.3.2, 1.3.3, 1.3.4
1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.4.21, 1.4.22, 1.4.23, 1.4.24, 1.4.25, 1.4.26, 1.4.27, 1.4.28, 1.4.29, 1.4.30

Clone this wiki locally