Package net.minecraft.item
Class BlockPredicatesChecker
java.lang.Object
net.minecraft.item.BlockPredicatesChecker
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
orCanDestroy
. - Mappings:
Namespace Name named net/minecraft/item/BlockPredicatesChecker
intermediary net/minecraft/class_6538
official csc
-
Field Summary
Modifier and TypeFieldDescriptionprivate @Nullable CachedBlockPosition
static final Text
static final Text
private static final Text
static final com.mojang.serialization.Codec
<BlockPredicatesChecker> private static final com.mojang.serialization.Codec
<BlockPredicatesChecker> private boolean
private boolean
static final PacketCodec
<RegistryByteBuf, BlockPredicatesChecker> private final List
<BlockPredicate> private final boolean
private static final com.mojang.serialization.Codec
<BlockPredicatesChecker> -
Constructor Summary
ModifierConstructorDescriptionBlockPredicatesChecker
(List<BlockPredicate> predicates, boolean showInTooltip) private
BlockPredicatesChecker
(List<BlockPredicate> predicates, boolean showInTooltip, List<Text> tooltipText) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTooltips
(Consumer<Text> adder) private static boolean
canUseCache
(CachedBlockPosition pos, @Nullable CachedBlockPosition cachedPos, boolean nbtAware) boolean
check
(CachedBlockPosition cachedPos) Returns true if any of the predicates in thestack
's NBT matched against the block atpos
, false otherwise.boolean
getTooltipText
(List<BlockPredicate> blockPredicates) int
hashCode()
boolean
toString()
withShowInTooltip
(boolean showInTooltip)
-
Field Details
-
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
Lcsc;e:Lcom/mojang/serialization/Codec;
-
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
Lcsc;f:Lcom/mojang/serialization/Codec;
-
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
Lcsc;a:Lcom/mojang/serialization/Codec;
-
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
Lcsc;b:Lzn;
-
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
Lcsc;c:Lxp;
-
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
Lcsc;d:Lxp;
-
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
Lcsc;g:Lxp;
-
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
Lcsc;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
Lcsc;i:Z
-
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
Lcsc;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
Lcsc;k:Ldsh;
-
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
Lcsc;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
Lcsc;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>
Lcsc;<init>(Ljava/util/List;ZLjava/util/List;)V
-
BlockPredicatesChecker
- 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>
Lcsc;<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
Lcsc;a(Ldsh;Ldsh;Z)Z
-
check
Returns true if any of the predicates in thestack
's NBT matched against the block atpos
, false otherwise.- Returns:
- true if any of the predicates in the
stack
's NBT matched against the block atpos
, 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
Lcsc;a(Ldsh;)Z
-
addTooltips
- 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
Lcsc;a(Ljava/util/function/Consumer;)V
-
withShowInTooltip
- 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
Lcsc;a(Z)Lcsc;
-
getTooltipText
- 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
Lcsc;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
Lcsc;a()Z
-
equals
-
hashCode
public int hashCode() -
toString
-