Class SpawnEggItem

java.lang.Object
net.minecraft.item.Item
net.minecraft.item.SpawnEggItem
All Implemented Interfaces:
ItemConvertible

public class SpawnEggItem extends Item
Mappings:
Namespace Name
official cbc
intermediary net/minecraft/class_1826
named net/minecraft/item/SpawnEggItem
  • Field Details

    • SPAWN_EGGS

      private static final Map<EntityType<? extends MobEntity>,SpawnEggItem> SPAWN_EGGS
      Mappings:
      Namespace Name Mixin selector
      official a Lcbc;a:Ljava/util/Map;
      intermediary field_8914 Lnet/minecraft/class_1826;field_8914:Ljava/util/Map;
      named SPAWN_EGGS Lnet/minecraft/item/SpawnEggItem;SPAWN_EGGS:Ljava/util/Map;
    • primaryColor

      private final int primaryColor
      Mappings:
      Namespace Name Mixin selector
      official b Lcbc;b:I
      intermediary field_8916 Lnet/minecraft/class_1826;field_8916:I
      named primaryColor Lnet/minecraft/item/SpawnEggItem;primaryColor:I
    • secondaryColor

      private final int secondaryColor
      Mappings:
      Namespace Name Mixin selector
      official c Lcbc;c:I
      intermediary field_8915 Lnet/minecraft/class_1826;field_8915:I
      named secondaryColor Lnet/minecraft/item/SpawnEggItem;secondaryColor:I
    • type

      private final EntityType<?> type
      Mappings:
      Namespace Name Mixin selector
      official d Lcbc;d:Lbau;
      intermediary field_8917 Lnet/minecraft/class_1826;field_8917:Lnet/minecraft/class_1299;
      named type Lnet/minecraft/item/SpawnEggItem;type:Lnet/minecraft/entity/EntityType;
  • Constructor Details

    • SpawnEggItem

      public SpawnEggItem(EntityType<? extends MobEntity> type, int primaryColor, int secondaryColor, Item.Settings settings)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcbc;<init>(Lbau;IILbzw$a;)V
      intermediary <init> Lnet/minecraft/class_1826;<init>(Lnet/minecraft/class_1299;IILnet/minecraft/class_1792$class_1793;)V
      named <init> Lnet/minecraft/item/SpawnEggItem;<init>(Lnet/minecraft/entity/EntityType;IILnet/minecraft/item/Item$Settings;)V
  • Method Details

    • useOnBlock

      public ActionResult useOnBlock(ItemUsageContext context)
      Called when an item is used on a block.

      This method is called on both the logical client and logical server, so take caution when using this method. The logical side can be checked using context.getWorld().isClient().

      Overrides:
      useOnBlock in class Item
      Parameters:
      context - the usage context
      Returns:
      an action result that specifies if using the item on a block was successful.
      Mappings:
      Namespace Name Mixin selector
      official a Lbzw;a(Lccc;)Lazm;
      intermediary method_7884 Lnet/minecraft/class_1792;method_7884(Lnet/minecraft/class_1838;)Lnet/minecraft/class_1269;
      named useOnBlock Lnet/minecraft/item/Item;useOnBlock(Lnet/minecraft/item/ItemUsageContext;)Lnet/minecraft/util/ActionResult;
    • use

      public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand)
      Called when an item is used by a player. The use action, by default, is bound to the right mouse button.

      This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using world.isClient().

      Overrides:
      use in class Item
      Parameters:
      world - the world the item was used in
      user - the player who used the item
      hand - the hand used
      Returns:
      a typed action result that specifies whether using the item was successful. The action result contains the new item stack that the player's hand will be set to.
      Mappings:
      Namespace Name Mixin selector
      official a Lbzw;a(Lcga;Lbtf;Lazl;)Lazn;
      intermediary method_7836 Lnet/minecraft/class_1792;method_7836(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;
      named use Lnet/minecraft/item/Item;use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;
    • isOfSameEntityType

      public boolean isOfSameEntityType(@Nullable @Nullable NbtCompound nbt, EntityType<?> type)
      Mappings:
      Namespace Name Mixin selector
      official a Lcbc;a(Lpj;Lbau;)Z
      intermediary method_8018 Lnet/minecraft/class_1826;method_8018(Lnet/minecraft/class_2487;Lnet/minecraft/class_1299;)Z
      named isOfSameEntityType Lnet/minecraft/item/SpawnEggItem;isOfSameEntityType(Lnet/minecraft/nbt/NbtCompound;Lnet/minecraft/entity/EntityType;)Z
    • getColor

      public int getColor(int tintIndex)
      Returns the color of the specified tint index.
      Parameters:
      tintIndex - the tint index
      Returns:
      the color of the specified tint index
      Implementation Requirements:
      If the tint index is 0, returns primaryColor. Otherwise, returns secondaryColor.
      Mappings:
      Namespace Name Mixin selector
      official a Lcbc;a(I)I
      intermediary method_8016 Lnet/minecraft/class_1826;method_8016(I)I
      named getColor Lnet/minecraft/item/SpawnEggItem;getColor(I)I
    • forEntity

      @Nullable public static @Nullable SpawnEggItem forEntity(@Nullable @Nullable EntityType<?> type)
      Mappings:
      Namespace Name Mixin selector
      official a Lcbc;a(Lbau;)Lcbc;
      intermediary method_8019 Lnet/minecraft/class_1826;method_8019(Lnet/minecraft/class_1299;)Lnet/minecraft/class_1826;
      named forEntity Lnet/minecraft/item/SpawnEggItem;forEntity(Lnet/minecraft/entity/EntityType;)Lnet/minecraft/item/SpawnEggItem;
    • getAll

      public static Iterable<SpawnEggItem> getAll()
      Mappings:
      Namespace Name Mixin selector
      official i Lcbc;i()Ljava/lang/Iterable;
      intermediary method_8017 Lnet/minecraft/class_1826;method_8017()Ljava/lang/Iterable;
      named getAll Lnet/minecraft/item/SpawnEggItem;getAll()Ljava/lang/Iterable;
    • getEntityType

      public EntityType<?> getEntityType(@Nullable @Nullable NbtCompound nbt)
      Mappings:
      Namespace Name Mixin selector
      official a Lcbc;a(Lpj;)Lbau;
      intermediary method_8015 Lnet/minecraft/class_1826;method_8015(Lnet/minecraft/class_2487;)Lnet/minecraft/class_1299;
      named getEntityType Lnet/minecraft/item/SpawnEggItem;getEntityType(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/entity/EntityType;
    • spawnBaby

      public Optional<MobEntity> spawnBaby(PlayerEntity user, MobEntity entity, EntityType<? extends MobEntity> entityType, ServerWorld world, Vec3d pos, ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official a Lcbc;a(Lbtf;Lbbh;Lbau;Lafo;Ldvs;Lcaa;)Ljava/util/Optional;
      intermediary method_24793 Lnet/minecraft/class_1826;method_24793(Lnet/minecraft/class_1657;Lnet/minecraft/class_1308;Lnet/minecraft/class_1299;Lnet/minecraft/class_3218;Lnet/minecraft/class_243;Lnet/minecraft/class_1799;)Ljava/util/Optional;
      named spawnBaby Lnet/minecraft/item/SpawnEggItem;spawnBaby(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/mob/MobEntity;Lnet/minecraft/entity/EntityType;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/item/ItemStack;)Ljava/util/Optional;