Posted March 10, 20223 yr How do you check if a block is in a certain type of block through tags? I have my tag json setup and the tagkey created. I just don't know how to check a block placed in the world to the tag Edited March 12, 20223 yr by quoopie Issue has been solved
March 10, 20223 yr Author I have been doing that so lemme make sure my code is correct. Anytime "testmod" is used it's the mod I'm currently working on. I do not understand why it's not working keytag json: Spoiler { "replace" : false, "values" : [ "testmod:citrine_ore", "testmod:deepslate_citrine_ore", "testmod:endstone_citrine_ore", "testmod.netherrack_citrine_ore", "minecraft:coal_ore", "minecraft:deepslate_coal_ore", "minecraft:iron_ore", "minecraft:deepslate_iron_ore", "minecraft:redstone_ore", "minecraft:deepslate_redstone_ore", "minecraft:lapis_ore", "minecraft:deepslate_lapis_ore", "minecraft:diamond_ore", "minecraft:deepslate_diamond_ore", "minecraft:emerald_ore", "minecraft:deepslate_emerald_ore", "minecraft:gold_ore", "minecraft:deepslate_gold_ore", "minecraft:copper_ore", "minecraft:deepslate_copper_ore" ] } function testing blockstates with: Spoiler private boolean isValuable(BlockState block) { return block.is(ModTags.Blocks.DOWSING_ROD_VALUABLES); } How blockstates are getting passed in: Spoiler for (int i = 0; i <= positionClicked.getY() + 64; i++) { BlockState blockBelow = pContext.getLevel().getBlockState(positionClicked.below(i)); if (isValuable(blockBelow)) { outputValuableCoordinates(positionClicked.below(i), player, blockBelow); blockNotFound = false; break; } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.