Class BucketLibUtil

java.lang.Object
de.cech12.bucketlib.util.BucketLibUtil

public class BucketLibUtil extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.resources.Identifier
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.world.item.ItemStack
    addBlock(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.block.Block block)
     
    static net.minecraft.world.item.ItemStack
    addContent(net.minecraft.world.item.ItemStack itemStack, net.minecraft.resources.Identifier content)
     
    static net.minecraft.world.item.ItemStack
    addEntityType(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.entity.EntityType<?> entityType)
     
    static net.minecraft.world.item.ItemStack
    addFluid(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.material.Fluid fluid)
     
    static net.minecraft.world.item.ItemStack
    addMilk(net.minecraft.world.item.ItemStack itemStack)
     
    static boolean
    containsBlock(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static boolean
    containsContent(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static boolean
    containsEntityType(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static boolean
    containsFluid(net.minecraft.world.item.ItemInstance itemInstance)
     
    static boolean
    containsMilk(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static net.minecraft.world.item.ItemStack
    createEmptyResult(net.minecraft.world.item.ItemStack initialStack, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack resultStack, net.minecraft.world.InteractionHand hand)
     
    static net.minecraft.world.item.ItemStack
    createEmptyResult(net.minecraft.world.item.ItemStack initialStack, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack resultStack, net.minecraft.world.InteractionHand hand, boolean addAdditionalBucketOnInstaBuild)
     
    static void
    damageByOne(net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.server.level.ServerPlayer player)
    Deprecated.
    It is recommended to use damageByOne(ItemStack, ServerLevel, Player) instead.
    static void
    damageByOne(net.minecraft.world.item.ItemStack stack, net.minecraft.server.level.ServerLevel level, net.minecraft.world.entity.player.Player player)
    Adds damage to the bucket if damaging is enabled.
    static net.minecraft.world.level.block.Block
    getBlock(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static net.minecraft.resources.Identifier
    getContent(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static String
    getContentString(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static net.minecraft.world.entity.EntityType<?>
    getEntityType(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static String
    getEntityTypeString(net.minecraft.core.component.DataComponentGetter componentGetter)
     
    static net.minecraft.world.level.material.Fluid
    getFluid(net.minecraft.world.item.ItemInstance itemInstance)
     
    static net.minecraft.world.item.Item
    getItem(net.minecraft.world.item.ItemInstance itemInstance)
     
    static net.minecraft.world.item.ItemStack
    getItemStack(net.minecraft.world.item.ItemInstance itemInstance)
     
    static net.minecraft.world.item.ItemStackTemplate
    getItemStackTemplate(net.minecraft.world.item.ItemInstance itemInstance)
     
    static boolean
    hasInfinityEnchantment(@NotNull net.minecraft.world.item.ItemInstance itemInstance)
    Checks if the given bucket is enchanted with the Infinity enchantment.
    static boolean
    isAffectedByInfinityEnchantment(@NotNull net.minecraft.world.item.ItemInstance itemInstance)
    Checks if the given bucket is affected by Infinity enchantment.
    static boolean
    isEmpty(net.minecraft.world.item.ItemInstance itemInstance)
     
    static boolean
    isInfinityEnchantmentAllowed(@NotNull net.minecraft.world.item.ItemInstance itemInstance)
    Checks if the given bucket is allowed to be enchanted with Infinity enchantment.
    static boolean
    notCreative(net.minecraft.world.entity.Entity entity)
     
    static net.minecraft.world.item.ItemStack
    removeBlock(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable net.minecraft.world.entity.player.Player player, boolean damage)
     
    static void
    removeContentNoCopy(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable net.minecraft.world.entity.player.Player player, boolean damage)
     
    static net.minecraft.world.item.ItemStack
    removeEntityData(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable net.minecraft.world.entity.player.Player player, boolean damage)
     
    static net.minecraft.world.item.ItemStack
    removeEntityData(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable net.minecraft.world.entity.player.Player player, @Nullable net.minecraft.world.entity.Entity entity, boolean damage)
     
    static net.minecraft.world.item.ItemStack
    removeFluid(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable net.minecraft.world.entity.player.Player player)
     
    static net.minecraft.world.item.ItemStack
    removeMilk(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable net.minecraft.world.entity.player.Player player)
     

    Methods inherited from class Object

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

    • MILK_LOCATION

      public static final net.minecraft.resources.Identifier MILK_LOCATION
  • Method Details

    • notCreative

      public static boolean notCreative(net.minecraft.world.entity.Entity entity)
    • getItem

      public static net.minecraft.world.item.Item getItem(net.minecraft.world.item.ItemInstance itemInstance)
    • getItemStack

      public static net.minecraft.world.item.ItemStack getItemStack(net.minecraft.world.item.ItemInstance itemInstance)
    • getItemStackTemplate

      public static net.minecraft.world.item.ItemStackTemplate getItemStackTemplate(net.minecraft.world.item.ItemInstance itemInstance)
    • isEmpty

      public static boolean isEmpty(net.minecraft.world.item.ItemInstance itemInstance)
    • createEmptyResult

      public static net.minecraft.world.item.ItemStack createEmptyResult(net.minecraft.world.item.ItemStack initialStack, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack resultStack, net.minecraft.world.InteractionHand hand)
    • createEmptyResult

      public static net.minecraft.world.item.ItemStack createEmptyResult(net.minecraft.world.item.ItemStack initialStack, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack resultStack, net.minecraft.world.InteractionHand hand, boolean addAdditionalBucketOnInstaBuild)
    • damageByOne

      public static void damageByOne(net.minecraft.world.item.ItemStack stack, net.minecraft.server.level.ServerLevel level, net.minecraft.world.entity.player.Player player)
      Adds damage to the bucket if damaging is enabled.
      Parameters:
      stack - item stack which gets damage
      level - ServerLevel
      player - Player object or null if no player is involved
    • damageByOne

      @Deprecated public static void damageByOne(net.minecraft.world.item.ItemStack stack, @Nullable @Nullable net.minecraft.server.level.ServerPlayer player)
      Deprecated.
      It is recommended to use damageByOne(ItemStack, ServerLevel, Player) instead.
      Adds damage to the bucket if damaging is enabled. This method should only be used if there is no ServerLevel in the calling context. Enchantments have no effect here!
      Parameters:
      stack - item stack which gets damage
    • isAffectedByInfinityEnchantment

      public static boolean isAffectedByInfinityEnchantment(@NotNull @NotNull net.minecraft.world.item.ItemInstance itemInstance)
      Checks if the given bucket is affected by Infinity enchantment.
      Parameters:
      itemInstance - checked item instance
      Returns:
      boolean
    • hasInfinityEnchantment

      public static boolean hasInfinityEnchantment(@NotNull @NotNull net.minecraft.world.item.ItemInstance itemInstance)
      Checks if the given bucket is enchanted with the Infinity enchantment.
      Parameters:
      itemInstance - checked item instance
      Returns:
      boolean
    • isInfinityEnchantmentAllowed

      public static boolean isInfinityEnchantmentAllowed(@NotNull @NotNull net.minecraft.world.item.ItemInstance itemInstance)
      Checks if the given bucket is allowed to be enchanted with Infinity enchantment.
      Parameters:
      itemInstance - checked item instance
      Returns:
      boolean
    • containsContent

      public static boolean containsContent(net.minecraft.core.component.DataComponentGetter componentGetter)
    • getContent

      public static net.minecraft.resources.Identifier getContent(net.minecraft.core.component.DataComponentGetter componentGetter)
    • getContentString

      public static String getContentString(net.minecraft.core.component.DataComponentGetter componentGetter)
    • addContent

      public static net.minecraft.world.item.ItemStack addContent(net.minecraft.world.item.ItemStack itemStack, net.minecraft.resources.Identifier content)
    • removeContentNoCopy

      public static void removeContentNoCopy(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable @Nullable net.minecraft.world.entity.player.Player player, boolean damage)
    • containsMilk

      public static boolean containsMilk(net.minecraft.core.component.DataComponentGetter componentGetter)
    • addMilk

      public static net.minecraft.world.item.ItemStack addMilk(net.minecraft.world.item.ItemStack itemStack)
    • removeMilk

      public static net.minecraft.world.item.ItemStack removeMilk(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable @Nullable net.minecraft.world.entity.player.Player player)
    • containsFluid

      public static boolean containsFluid(net.minecraft.world.item.ItemInstance itemInstance)
    • getFluid

      public static net.minecraft.world.level.material.Fluid getFluid(net.minecraft.world.item.ItemInstance itemInstance)
    • addFluid

      public static net.minecraft.world.item.ItemStack addFluid(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.material.Fluid fluid)
    • removeFluid

      public static net.minecraft.world.item.ItemStack removeFluid(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable @Nullable net.minecraft.world.entity.player.Player player)
    • containsEntityType

      public static boolean containsEntityType(net.minecraft.core.component.DataComponentGetter componentGetter)
    • getEntityType

      public static net.minecraft.world.entity.EntityType<?> getEntityType(net.minecraft.core.component.DataComponentGetter componentGetter)
    • getEntityTypeString

      public static String getEntityTypeString(net.minecraft.core.component.DataComponentGetter componentGetter)
    • addEntityType

      public static net.minecraft.world.item.ItemStack addEntityType(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.entity.EntityType<?> entityType)
    • removeEntityData

      public static net.minecraft.world.item.ItemStack removeEntityData(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable @Nullable net.minecraft.world.entity.player.Player player, boolean damage)
    • removeEntityData

      public static net.minecraft.world.item.ItemStack removeEntityData(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable @Nullable net.minecraft.world.entity.player.Player player, @Nullable @Nullable net.minecraft.world.entity.Entity entity, boolean damage)
    • containsBlock

      public static boolean containsBlock(net.minecraft.core.component.DataComponentGetter componentGetter)
    • getBlock

      public static net.minecraft.world.level.block.Block getBlock(net.minecraft.core.component.DataComponentGetter componentGetter)
    • addBlock

      public static net.minecraft.world.item.ItemStack addBlock(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.block.Block block)
    • removeBlock

      public static net.minecraft.world.item.ItemStack removeBlock(net.minecraft.world.item.ItemStack itemStack, net.minecraft.server.level.ServerLevel level, @Nullable @Nullable net.minecraft.world.entity.player.Player player, boolean damage)