Class BlockPredicatesChecker

java.lang.Object
net.minecraft.item.BlockPredicatesChecker

public class BlockPredicatesChecker extends Object
Checks if a block predicate stored inside ItemStack's NBT matches the block in a world. The predicate must be stored inside the key sub NBT of the item stack.

The result is cached to reduce cost for successive lookups on the same block.

API Note:
This is used to implement checks for restrictions specified using CanPlaceOn or CanDestroy.
Mappings:
Namespace Name
named net/minecraft/item/BlockPredicatesChecker
intermediary net/minecraft/class_6538
official cvk
  • Field Details

    • SINGLE_CODEC

      private static final com.mojang.serialization.Codec<BlockPredicatesChecker> SINGLE_CODEC
      Mappings:
      Namespace Name Mixin selector
      named SINGLE_CODEC Lnet/minecraft/item/BlockPredicatesChecker;SINGLE_CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_49249 Lnet/minecraft/class_6538;field_49249:Lcom/mojang/serialization/Codec;
      official e Lcvk;e:Lcom/mojang/serialization/Codec;
    • FULL_CODEC

      private static final com.mojang.serialization.Codec<BlockPredicatesChecker> FULL_CODEC
      Mappings:
      Namespace Name Mixin selector
      named FULL_CODEC Lnet/minecraft/item/BlockPredicatesChecker;FULL_CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_49250 Lnet/minecraft/class_6538;field_49250:Lcom/mojang/serialization/Codec;
      official f Lcvk;f:Lcom/mojang/serialization/Codec;
    • CODEC

      public static final com.mojang.serialization.Codec<BlockPredicatesChecker> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/item/BlockPredicatesChecker;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_49245 Lnet/minecraft/class_6538;field_49245:Lcom/mojang/serialization/Codec;
      official a Lcvk;a:Lcom/mojang/serialization/Codec;
    • PACKET_CODEC

      public static final PacketCodec<RegistryByteBuf,BlockPredicatesChecker> PACKET_CODEC
      Mappings:
      Namespace Name Mixin selector
      named PACKET_CODEC Lnet/minecraft/item/BlockPredicatesChecker;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
      intermediary field_49246 Lnet/minecraft/class_6538;field_49246:Lnet/minecraft/class_9139;
      official b Lcvk;b:Lzt;
    • CAN_BREAK_TEXT

      public static final Text CAN_BREAK_TEXT
      Mappings:
      Namespace Name Mixin selector
      named CAN_BREAK_TEXT Lnet/minecraft/item/BlockPredicatesChecker;CAN_BREAK_TEXT:Lnet/minecraft/text/Text;
      intermediary field_49247 Lnet/minecraft/class_6538;field_49247:Lnet/minecraft/class_2561;
      official c Lcvk;c:Lxv;
    • CAN_PLACE_TEXT

      public static final Text CAN_PLACE_TEXT
      Mappings:
      Namespace Name Mixin selector
      named CAN_PLACE_TEXT Lnet/minecraft/item/BlockPredicatesChecker;CAN_PLACE_TEXT:Lnet/minecraft/text/Text;
      intermediary field_49248 Lnet/minecraft/class_6538;field_49248:Lnet/minecraft/class_2561;
      official d Lcvk;d:Lxv;
    • CAN_USE_UNKNOWN_TEXT

      private static final Text CAN_USE_UNKNOWN_TEXT
      Mappings:
      Namespace Name Mixin selector
      named CAN_USE_UNKNOWN_TEXT Lnet/minecraft/item/BlockPredicatesChecker;CAN_USE_UNKNOWN_TEXT:Lnet/minecraft/text/Text;
      intermediary field_49251 Lnet/minecraft/class_6538;field_49251:Lnet/minecraft/class_2561;
      official g Lcvk;g:Lxv;
    • predicates

      private final List<BlockPredicate> predicates
      Mappings:
      Namespace Name Mixin selector
      named predicates Lnet/minecraft/item/BlockPredicatesChecker;predicates:Ljava/util/List;
      intermediary field_49252 Lnet/minecraft/class_6538;field_49252:Ljava/util/List;
      official h Lcvk;h:Ljava/util/List;
    • showInTooltip

      private final boolean showInTooltip
      Mappings:
      Namespace Name Mixin selector
      named showInTooltip Lnet/minecraft/item/BlockPredicatesChecker;showInTooltip:Z
      intermediary field_49253 Lnet/minecraft/class_6538;field_49253:Z
      official i Lcvk;i:Z
    • tooltipText

      @Nullable private @Nullable List<Text> tooltipText
      Mappings:
      Namespace Name Mixin selector
      named tooltipText Lnet/minecraft/item/BlockPredicatesChecker;tooltipText:Ljava/util/List;
      intermediary field_49254 Lnet/minecraft/class_6538;field_49254:Ljava/util/List;
      official j Lcvk;j:Ljava/util/List;
    • cachedPos

      Mappings:
      Namespace Name Mixin selector
      named cachedPos Lnet/minecraft/item/BlockPredicatesChecker;cachedPos:Lnet/minecraft/block/pattern/CachedBlockPosition;
      intermediary field_34450 Lnet/minecraft/class_6538;field_34450:Lnet/minecraft/class_2694;
      official k Lcvk;k:Ldxy;
    • lastResult

      private boolean lastResult
      Mappings:
      Namespace Name Mixin selector
      named lastResult Lnet/minecraft/item/BlockPredicatesChecker;lastResult:Z
      intermediary field_34451 Lnet/minecraft/class_6538;field_34451:Z
      official l Lcvk;l:Z
    • nbtAware

      private boolean nbtAware
      Mappings:
      Namespace Name Mixin selector
      named nbtAware Lnet/minecraft/item/BlockPredicatesChecker;nbtAware:Z
      intermediary field_34452 Lnet/minecraft/class_6538;field_34452:Z
      official m Lcvk;m:Z
  • Constructor Details

    • BlockPredicatesChecker

      public BlockPredicatesChecker(List<BlockPredicate> predicates, boolean showInTooltip)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/item/BlockPredicatesChecker;<init>(Ljava/util/List;Z)V
      intermediary <init> Lnet/minecraft/class_6538;<init>(Ljava/util/List;Z)V
      official <init> Lcvk;<init>(Ljava/util/List;Z)V
  • Method Details

    • canUseCache

      private static boolean canUseCache(CachedBlockPosition pos, @Nullable @Nullable CachedBlockPosition cachedPos, boolean nbtAware)
      Mappings:
      Namespace Name Mixin selector
      named canUseCache Lnet/minecraft/item/BlockPredicatesChecker;canUseCache(Lnet/minecraft/block/pattern/CachedBlockPosition;Lnet/minecraft/block/pattern/CachedBlockPosition;Z)Z
      intermediary method_38071 Lnet/minecraft/class_6538;method_38071(Lnet/minecraft/class_2694;Lnet/minecraft/class_2694;Z)Z
      official a Lcvk;a(Ldxy;Ldxy;Z)Z
    • check

      public boolean check(CachedBlockPosition cachedPos)
      Returns true if any of the predicates in the stack's NBT matched against the block at pos, false otherwise.
      Returns:
      true if any of the predicates in the stack's NBT matched against the block at pos, false otherwise
      Mappings:
      Namespace Name Mixin selector
      named check Lnet/minecraft/item/BlockPredicatesChecker;check(Lnet/minecraft/block/pattern/CachedBlockPosition;)Z
      intermediary method_38070 Lnet/minecraft/class_6538;method_38070(Lnet/minecraft/class_2694;)Z
      official a Lcvk;a(Ldxy;)Z
    • getOrCreateTooltipText

      private List<Text> getOrCreateTooltipText()
      Mappings:
      Namespace Name Mixin selector
      named getOrCreateTooltipText Lnet/minecraft/item/BlockPredicatesChecker;getOrCreateTooltipText()Ljava/util/List;
      intermediary method_65042 Lnet/minecraft/class_6538;method_65042()Ljava/util/List;
      official b Lcvk;b()Ljava/util/List;
    • addTooltips

      public void addTooltips(Consumer<Text> adder)
      Mappings:
      Namespace Name Mixin selector
      named addTooltips Lnet/minecraft/item/BlockPredicatesChecker;addTooltips(Ljava/util/function/Consumer;)V
      intermediary method_57330 Lnet/minecraft/class_6538;method_57330(Ljava/util/function/Consumer;)V
      official a Lcvk;a(Ljava/util/function/Consumer;)V
    • withShowInTooltip

      public BlockPredicatesChecker withShowInTooltip(boolean showInTooltip)
      Mappings:
      Namespace Name Mixin selector
      named withShowInTooltip Lnet/minecraft/item/BlockPredicatesChecker;withShowInTooltip(Z)Lnet/minecraft/item/BlockPredicatesChecker;
      intermediary method_58402 Lnet/minecraft/class_6538;method_58402(Z)Lnet/minecraft/class_6538;
      official a Lcvk;a(Z)Lcvk;
    • createTooltipText

      private static List<Text> createTooltipText(List<BlockPredicate> blockPredicates)
      Mappings:
      Namespace Name Mixin selector
      named createTooltipText Lnet/minecraft/item/BlockPredicatesChecker;createTooltipText(Ljava/util/List;)Ljava/util/List;
      intermediary method_57329 Lnet/minecraft/class_6538;method_57329(Ljava/util/List;)Ljava/util/List;
      official a Lcvk;a(Ljava/util/List;)Ljava/util/List;
    • showInTooltip

      public boolean showInTooltip()
      Mappings:
      Namespace Name Mixin selector
      named showInTooltip Lnet/minecraft/item/BlockPredicatesChecker;showInTooltip()Z
      intermediary method_57324 Lnet/minecraft/class_6538;method_57324()Z
      official a Lcvk;a()Z
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      Mappings:
      Namespace Name Mixin selector
      named equals Lnet/minecraft/item/BlockPredicatesChecker;equals(Ljava/lang/Object;)Z
      intermediary equals Lnet/minecraft/class_6538;equals(Ljava/lang/Object;)Z
      official equals Lcvk;equals(Ljava/lang/Object;)Z
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object