Jump to content

[1.18.1] Custom Torch


Recommended Posts

I'm looking to make a custom torch (well two but anyway). I've been looking at vanilla and think I'm almost there, but just having some issues with registration.

In particular where I'm calling fromBlock for the two TORCH_ITEMS below cannot be resolved:

    public static final RegistryObject<Block> LIGHTSTONE_TORCH = BLOCKS.register("lightstone_torch", () -> new TorchBlock(BlockBehaviour.Properties.of(Material.DECORATION)
            .noCollission().instabreak().lightLevel((p_50886_) -> {return 10;})
            .sound(SoundType.GLASS), ParticleTypes.FLAME));
    public static final RegistryObject<Block> WALL_LIGHTSTONE_TORCH = BLOCKS.register ("wall_lightstone_torch", () -> new WallTorchBlock((BlockBehaviour.Properties.of(Material.DECORATION)
            .noCollission().instabreak().lightLevel((p_152607_) -> {return 10;})
            .sound(SoundType.GLASS).dropsLike(Registration.LIGHTSTONE_TORCH.get())), ParticleTypes.FLAME));
    public static final RegistryObject<Item> LIGHTSTONE_TORCH_ITEM = new StandingAndWallBlockItem.fromBlock(LIGHTSTONE_TORCH).ItemProperties();
    public static final RegistryObject<Block> LIGHTSTONE_REFINED_TORCH = BLOCKS.register("lightstone_refined_torch", () -> new TorchBlock(BlockBehaviour.Properties.of(Material.DECORATION)
            .noCollission().instabreak().lightLevel((p_50886_) -> {return 15;})
            .sound(SoundType.GLASS), ParticleTypes.FLAME));
    public static final RegistryObject<Block> WALL_LIGHTSTONE_REFINED_TORCH = BLOCKS.register ("wall_lightstone_refined_torch", () -> new WallTorchBlock((BlockBehaviour.Properties.of(Material.DECORATION)
            .noCollission().instabreak().lightLevel((p_152607_) -> {return 15;})
            .sound(SoundType.GLASS).dropsLike(Registration.LIGHTSTONE_REFINED_TORCH.get())), ParticleTypes.FLAME));
    public static final RegistryObject<Item> LIGHTSTONE_REFINED_TORCH_ITEM = new StandingAndWallBlockItem.fromBlock(LIGHTSTONE_REFINED_TORCH).ItemProperties();

Rest of my datagen is here should it be needed - https://github.com/Mattah12/Kanohi_Craft2022/tree/master/src/main/java/com/Mattah12/kanohicraft/datagen

Edited by Mattah12
Link to comment
Share on other sites

19 minutes ago, Mattah12 said:
new StandingAndWallBlockItem.fromBlock(LIGHTSTONE_TORCH).ItemProperties();

this is completely wrong

you need to do it like you done it with Blocks, create a DeferredRegister for Items then call DeferredRegister#register
inside the supplier you need to create a new instance of StandingAndWallBlockItem

Link to comment
Share on other sites

Ah OK, so more like this?

public static final RegistryObject<StandingAndWallBlockItem> LIGHTSTONE_TORCH_ITEM = ITEMS.register("lightstone_torch_item", () -> new StandingAndWallBlockItem(Registration.LIGHTSTONE_TORCH.get(), Registration.WALL_LIGHTSTONE_TORCH.get(), new Item.Properties()));


Link to comment
Share on other sites

8 minutes ago, Luis_ST said:

yes that should work

i would recommend you to set a CreativeModeTab but this is optional

Funilly enough I was just doing that as it was causing issues with my loot tables.

I think I also have more work to do on the WALL blocks but thats tomorrows problem.

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.