Jump to content

Recommended Posts

Posted (edited)

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 by quoopie
Issue has been solved
Posted

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;
	}
}

 

 

  • quoopie changed the title to [1.18.2] Check block with tags [SOLVED]

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.