Interface IPartItem<P extends IPart>

All Superinterfaces:
net.minecraft.world.level.ItemLike

public interface IPartItem<P extends IPart> extends net.minecraft.world.level.ItemLike
When implementing a custom part, you must create an item to both represent the part in NBT and Packet data, and to actually place the part onto the bus. Implement this interface on your part Item.

To help with placing parts onto buses, use

invalid reference
PartHelper#usePartItem(ItemStack, BlockPos, Direction, Player, InteractionHand, Level)
to implement your items Item.useOn(UseOnContext) method.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable IPartItem<?>
    byId(net.minecraft.resources.ResourceLocation id)
    Retrieve a part item by its id.
    static @Nullable IPartItem<?>
    byNetworkId(int id)
    Retrieve a part item by its id.
    create a new part INSTANCE
    static net.minecraft.resources.ResourceLocation
    getId(IPartItem<?> item)
     
    static int
     
     

    Methods inherited from interface net.minecraft.world.level.ItemLike

    asItem
  • Method Details

    • getPartClass

      Class<P> getPartClass()
      Returns:
      The class of the parts that will be created by this part item.
    • createPart

      P createPart()
      create a new part INSTANCE
      Returns:
      part from item
    • getId

      static net.minecraft.resources.ResourceLocation getId(IPartItem<?> item)
      Returns:
      The registry id for this item.
    • getNetworkId

      static int getNetworkId(IPartItem<?> item)
      Returns:
      The registry id for this item, suitable for network serialization.
    • byId

      @Nullable static @Nullable IPartItem<?> byId(net.minecraft.resources.ResourceLocation id)
      Retrieve a part item by its id.
    • byNetworkId

      @Nullable static @Nullable IPartItem<?> byNetworkId(int id)
      Retrieve a part item by its id.