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 CanPlaceOnorCanDestroy.
- Mappings:
- Namespace - Name - official - cdh- intermediary - net/minecraft/class_6538- named - net/minecraft/item/BlockPredicatesChecker
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate @Nullable CachedBlockPositionprivate final Stringprivate booleanprivate boolean
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprivate static booleancanUseCache(CachedBlockPosition pos, @Nullable CachedBlockPosition cachedPos, boolean nbtAware) booleancheck(ItemStack stack, Registry<Block> blockRegistry, CachedBlockPosition pos) Returns true if any of the predicates in thestack's NBT matched against the block atpos, false otherwise.
- 
Field Details- 
key- Mappings:
- Namespace - Name - Mixin selector - official - a- Lcdh;a:Ljava/lang/String;- intermediary - field_34449- Lnet/minecraft/class_6538;field_34449:Ljava/lang/String;- named - key- Lnet/minecraft/item/BlockPredicatesChecker;key:Ljava/lang/String;
 
- 
cachedPos- Mappings:
- Namespace - Name - Mixin selector - official - b- Lcdh;b:Ldcf;- intermediary - field_34450- Lnet/minecraft/class_6538;field_34450:Lnet/minecraft/class_2694;- named - cachedPos- Lnet/minecraft/item/BlockPredicatesChecker;cachedPos:Lnet/minecraft/block/pattern/CachedBlockPosition;
 
- 
lastResultprivate boolean lastResult- Mappings:
- Namespace - Name - Mixin selector - official - c- Lcdh;c:Z- intermediary - field_34451- Lnet/minecraft/class_6538;field_34451:Z- named - lastResult- Lnet/minecraft/item/BlockPredicatesChecker;lastResult:Z
 
- 
nbtAwareprivate boolean nbtAware- Mappings:
- Namespace - Name - Mixin selector - official - d- Lcdh;d:Z- intermediary - field_34452- Lnet/minecraft/class_6538;field_34452:Z- named - nbtAware- Lnet/minecraft/item/BlockPredicatesChecker;nbtAware:Z
 
 
- 
- 
Constructor Details- 
BlockPredicatesChecker- Parameters:
- key- the sub NBT key that stores the predicate, for example- "CanPlaceOn"
- Mappings:
- Namespace - Name - Mixin selector - official - <init>- Lcdh;<init>(Ljava/lang/String;)V- intermediary - <init>- Lnet/minecraft/class_6538;<init>(Ljava/lang/String;)V- named - <init>- Lnet/minecraft/item/BlockPredicatesChecker;<init>(Ljava/lang/String;)V
 
 
- 
- 
Method Details- 
canUseCacheprivate static boolean canUseCache(CachedBlockPosition pos, @Nullable @Nullable CachedBlockPosition cachedPos, boolean nbtAware) - Mappings:
- Namespace - Name - Mixin selector - official - a- Lcdh;a(Ldcf;Ldcf;Z)Z- intermediary - method_38071- Lnet/minecraft/class_6538;method_38071(Lnet/minecraft/class_2694;Lnet/minecraft/class_2694;Z)Z- named - canUseCache- Lnet/minecraft/item/BlockPredicatesChecker;canUseCache(Lnet/minecraft/block/pattern/CachedBlockPosition;Lnet/minecraft/block/pattern/CachedBlockPosition;Z)Z
 
- 
checkReturns 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 - official - a- Lcdh;a(Lcfz;Lhr;Ldcf;)Z- intermediary - method_38070- Lnet/minecraft/class_6538;method_38070(Lnet/minecraft/class_1799;Lnet/minecraft/class_2378;Lnet/minecraft/class_2694;)Z- named - check- Lnet/minecraft/item/BlockPredicatesChecker;check(Lnet/minecraft/item/ItemStack;Lnet/minecraft/registry/Registry;Lnet/minecraft/block/pattern/CachedBlockPosition;)Z
 
 
-