Jump to content

[SOLVED][1.16.4] Get WallTorchBlock that matches TorchBlock/TorchItem


Recommended Posts

in items class we have...

public static final Item TORCH = register(new WallOrFloorItem(Blocks.TORCH, Blocks.WALL_TORCH, (new Item.Properties()).group(ItemGroup.DECORATIONS)));

and in blocks we have...

public static final Block SOUL_TORCH = register("soul_torch", new TorchBlock(AbstractBlock.Properties.create(Material.MISCELLANEOUS).doesNotBlockMovement().zeroHardnessAndResistance().setLightLevel((state) -> {
      return 10;
   }).sound(SoundType.WOOD), ParticleTypes.SOUL_FIRE_FLAME));
   public static final Block SOUL_WALL_TORCH = register("soul_wall_torch", new WallTorchBlock(AbstractBlock.Properties.create(Material.MISCELLANEOUS).doesNotBlockMovement().zeroHardnessAndResistance().setLightLevel((state) -> {
      return 10;
   }).sound(SoundType.WOOD).lootFrom(SOUL_TORCH), ParticleTypes.SOUL_FIRE_FLAME));

So is there any way to get the (Block wallBlockIn) value that is set by WallOrFloorItem through the item or the registry?
It makes sense that if the two are intertwined as they are there should be some way of doing this.

Or should I just start the gymnastic to loop over and pull out using the register names [basically using soul from "soul_torch" to look for "soul_"+wall+"_torch"] to get the correct block.

Of course I could also skip using tags to get my item list and instead make it a config in pairs to get the data in a more reliable and configurable by mod pack developers.

Edited by frakier
Link to comment
Share on other sites

Solved, that was the answer I made the tags json using the "wall_torch" version of each torch and then use that to get the other information i needed.

	"replace": false,
	"values": [

Then I was able to get the item using the wall_torch blocks and then from the item I could get the normal torch blocks. Kind of backwards way around but it worked.

Edited by frakier
Link to comment
Share on other sites

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.

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.


  • Create New...

Important Information

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