Class ServerUtil

java.lang.Object
com.hammy275.immersivemc.server.ServerUtil

public class ServerUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.world.item.ItemStack
    parseItem(net.minecraft.resources.RegistryOps<net.minecraft.nbt.Tag> ops, net.minecraft.nbt.CompoundTag nbt, int lastVanillaDataVersion)
    Loads an item from NBT, upgrading it between Minecraft versions as needed.
    static net.minecraft.nbt.Tag
    saveItem(net.minecraft.world.item.ItemStack stack, net.minecraft.resources.RegistryOps<net.minecraft.nbt.Tag> ops, net.minecraft.nbt.EndTag prefix)
    Saves an item to NBT, including allowing saving of empty ItemStack's.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServerUtil

      public ServerUtil()
  • Method Details

    • saveItem

      public static net.minecraft.nbt.Tag saveItem(net.minecraft.world.item.ItemStack stack, net.minecraft.resources.RegistryOps<net.minecraft.nbt.Tag> ops, net.minecraft.nbt.EndTag prefix)
      Saves an item to NBT, including allowing saving of empty ItemStack's.
      Parameters:
      stack - ItemStack to save.
      ops - Registry operations.
      prefix - Prefix
      Returns:
      Item saved to an NBT tag.
    • parseItem

      public static net.minecraft.world.item.ItemStack parseItem(net.minecraft.resources.RegistryOps<net.minecraft.nbt.Tag> ops, net.minecraft.nbt.CompoundTag nbt, int lastVanillaDataVersion)
      Loads an item from NBT, upgrading it between Minecraft versions as needed.
      Parameters:
      ops - Registry operations.
      nbt - The NBT being loaded.
      lastVanillaDataVersion - The last vanilla data version used to save the item.
      Returns:
      The loaded ItemStack.