Posted July 8, 20223 yr 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 July 8, 20223 yr by Mattah12
July 8, 20223 yr 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
July 8, 20223 yr Author 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()));
July 8, 20223 yr yes that should work i would recommend you to set a CreativeModeTab but this is optional
July 8, 20223 yr Author 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.
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.