Interface CompatHelper
- All Known Implementing Classes:
FabricCompatHelper
public interface CompatHelper
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanallModsLoaded(String... namespaces) default booleananyModsLoaded(String... namespaces) List<net.minecraft.world.item.ItemStack>backSlotDisabled(net.minecraft.world.entity.player.Player owner) static net.minecraft.world.entity.EntitycreateBackpackEntity(net.minecraft.world.item.ItemStack backpackStack, int x, double y, int z, float yaw, boolean onDeath, net.minecraft.core.Direction direction, net.minecraft.world.level.Level level, UUID uuid, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks) This method places a new backpack dependent on the ItemStack.default net.minecraft.world.item.ItemStackcreateEnderBackpack(Optional<UUID> uuid, boolean persistent) Creates a bound Ender Backpack to the provided UUID, if empty it will default to the first player who interacts with itstatic BackDatagetBackData(net.minecraft.world.entity.player.Player player) This hold all the data for the player.static net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>getBackpackInventory(net.minecraft.world.entity.player.Player player) Grabs the literal non-copy back inventory whether they have a backpack equipped or not.net.minecraft.world.item.ItemStackgetBackSlotItem(BackData backData, net.minecraft.world.item.ItemStack defaultItem) static net.minecraft.world.item.ItemStackgetBackStack(net.minecraft.world.entity.player.Player player) Collects the ItemStack worn by either the BackSlot, Trinkets, or Curios.getFluidTexture(net.minecraft.world.level.material.Fluid fluid, net.minecraft.client.renderer.texture.TextureAtlas blocksAtlas) default booleanbooleaninvokeListenersOnDeath(BackData backData) booleanisBackSlot(net.minecraft.world.inventory.Slot slot) booleanisModLoaded(String namespace) voidsetBackSlotItem(BackData data, net.minecraft.world.item.ItemStack stack) static voidsetBackStack(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack backStack) Sets the BackData stack and updates any other variables or compatibilities.static voidupdateBackpackInventory2C(net.minecraft.server.level.ServerPlayer player) Syncs the ServerPlayer's back inventory to that player's client.default voidupdateEnderEntry(@NotNull UUID uuid, String name, boolean translatable, String trim, net.minecraft.world.level.Level level) Updates an Ender Entry.default voidupdateEnderEntry(@NotNull UUID uuid, Optional<net.minecraft.network.chat.Component> name, Optional<net.minecraft.nbt.CompoundTag> trim, net.minecraft.world.level.Level level) Updates an Ender Entry.
-
Field Details
-
CURIOS
- See Also:
-
TRINKETS
- See Also:
-
ELYTRA_SLOT
- See Also:
-
MOD_MENU
- See Also:
-
CLOTH_CONFIG
- See Also:
-
-
Method Details
-
isModLoaded
-
anyModsLoaded
-
allModsLoaded
-
backSlotDisabled
List<net.minecraft.world.item.ItemStack> backSlotDisabled(net.minecraft.world.entity.player.Player owner) -
isBackSlot
boolean isBackSlot(net.minecraft.world.inventory.Slot slot) -
getFluidTexture
CauldronInventory.FluidAttributes getFluidTexture(net.minecraft.world.level.material.Fluid fluid, net.minecraft.client.renderer.texture.TextureAtlas blocksAtlas) -
graveModLoaded
default boolean graveModLoaded() -
setBackSlotItem
-
getBackSlotItem
net.minecraft.world.item.ItemStack getBackSlotItem(BackData backData, net.minecraft.world.item.ItemStack defaultItem) -
invokeListenersOnDeath
-
updateEnderEntry
default void updateEnderEntry(@NotNull @NotNull UUID uuid, Optional<net.minecraft.network.chat.Component> name, Optional<net.minecraft.nbt.CompoundTag> trim, net.minecraft.world.level.Level level) Updates an Ender Entry. If fields "name" or "trim" is Optional.empty(), it will not update those fields.- Parameters:
uuid- Entry to look up the specific ender entry.name- The displayed name of a bound ender backpack.trim- Taken directly from a trimmed ItemStack. The tag must contain a "pattern" and "material" string tag. If you are able to view a trimmed ItemStack, the tag is the contents of "Trim" and not "Trim" itself.
-
updateEnderEntry
default void updateEnderEntry(@NotNull @NotNull UUID uuid, @Nullable String name, boolean translatable, @Nullable String trim, net.minecraft.world.level.Level level) Updates an Ender Entry. If fields "name" or "trim" is null, it will not update those fields.- Parameters:
uuid- Entry to look up the specific ender entry.name- Written as a snbt string. ( §9Like This! )translatable- If true, the name field will be treated as a translation.trim- Written as a snbt tag. ( {pattern:"", material:""} )
-
createEnderBackpack
default net.minecraft.world.item.ItemStack createEnderBackpack(Optional<UUID> uuid, boolean persistent) Creates a bound Ender Backpack to the provided UUID, if empty it will default to the first player who interacts with it- Parameters:
uuid- Owner of the backpack inventory.persistent- If true, the owner tag cannot be overridden unless empty.
-
createBackpackEntity
@Nullable static net.minecraft.world.entity.Entity createBackpackEntity(net.minecraft.world.item.ItemStack backpackStack, int x, double y, int z, float yaw, boolean onDeath, net.minecraft.core.Direction direction, net.minecraft.world.level.Level level, UUID uuid, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks) This method places a new backpack dependent on the ItemStack. If a backpack cannot be created from the ItemStack null will be returned- Parameters:
onDeath- Determines whether to unbind an Ender Backpack if config allowsdirection- Direction.UP and Direction.DOWN implies the backpack is centered in the block, otherwise it will be hung and yaw will be ignoreduuid- uuid of the player it is placed by or in the case of Ender Backpacks, the owner of the inventorystacks- ItemStacks of the backpack. Can be null or empty. Will be ignored if Ender Backpack- Returns:
- The Backpack entity , else
nullif ItemStack cant turn into entity. Cast toEntityAbstractat the risk of refactoring breaking compat.
-
getBackpackInventory
static net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getBackpackInventory(net.minecraft.world.entity.player.Player player) Grabs the literal non-copy back inventory whether they have a backpack equipped or not.Be aware the tooltip graphic might need you to update the player's client after making changes. Use `updateBackpackInventory2C` below to sync the inventory.
-
updateBackpackInventory2C
static void updateBackpackInventory2C(net.minecraft.server.level.ServerPlayer player) Syncs the ServerPlayer's back inventory to that player's client. -
getBackStack
static net.minecraft.world.item.ItemStack getBackStack(net.minecraft.world.entity.player.Player player) Collects the ItemStack worn by either the BackSlot, Trinkets, or Curios.Will cause Curios/Trinkets instabilities if this stack is overridden. Always use `setBackStack()` below especially if making changes other than NBT or count.
-
setBackStack
static void setBackStack(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack backStack) Sets the BackData stack and updates any other variables or compatibilities. ItemStack.EMPTY- Parameters:
backStack- Passing ItemStack.EMPTY does not clear the back inventory but works otherwise.
-
getBackData
This hold all the data for the player. Powerful but refactors may break any compat with this method. Use if no other alternatives.
-