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 csd
  • 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 Lcsd;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 Lcsd;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 Lcsd;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 Lcsd;b:Lzn;
    • 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 Lcsd;c:Lxp;
    • 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 Lcsd;d:Lxp;
    • 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 Lcsd;g:Lxp;
    • 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 Lcsd;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 Lcsd;i:Z
    • tooltipText

      private final 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 Lcsd;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 Lcsd;k:Ldsi;
    • 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 Lcsd;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 Lcsd;m:Z
  • Constructor Details

    • BlockPredicatesChecker

      private BlockPredicatesChecker(List<BlockPredicate> predicates, boolean showInTooltip, List<Text> tooltipText)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/item/BlockPredicatesChecker;<init>(Ljava/util/List;ZLjava/util/List;)V
      intermediary <init> Lnet/minecraft/class_6538;<init>(Ljava/util/List;ZLjava/util/List;)V
      official <init> Lcsd;<init>(Ljava/util/List;ZLjava/util/List;)V
    • 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> Lcsd;<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 Lcsd;a(Ldsi;Ldsi;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 Lcsd;a(Ldsi;)Z
    • 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 Lcsd;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 Lcsd;a(Z)Lcsd;
    • getTooltipText

      private static List<Text> getTooltipText(List<BlockPredicate> blockPredicates)
      Mappings:
      Namespace Name Mixin selector
      named getTooltipText Lnet/minecraft/item/BlockPredicatesChecker;getTooltipText(Ljava/util/List;)Ljava/util/List;
      intermediary method_57329 Lnet/minecraft/class_6538;method_57329(Ljava/util/List;)Ljava/util/List;
      official a Lcsd;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 Lcsd;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 Lcsd;equals(Ljava/lang/Object;)Z
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object