Posted May 22, 20232 yr Can somebody give me a comprehensive tutorial on how to make a custom stair block? I'm trying to make some sort of black sand and want all the smooth and stone versions like vanilla. I tried using code from various mods but it didn't work. I also tried just doing it myself but that didn't work.
May 22, 20232 yr If you look at how vanilla implements it, you should see it's just as simple as creating a new `StairBlock` with the passed-in block supplier acting as a delegate to handle specific logic.
May 22, 20232 yr Author Yeah, I tried that (using the code for the oak stair) and renaming everything and it was full of errors. I checked to make sure there weren't any missing imports but nope.
May 22, 20232 yr Author Error: src\main\java\net\the_typholorian\adventurous\init\AdventurousModBlocks.java:25: error: cannot find symbol public static final Block VOLCANIC_SANDSTONE_STAIRS = register("volcanic_sandstone_stairs", new StairBlock(VOLCANIC_SANDSTONE.defaultBlockState(), BlockBehaviour.Properties.copy(VOLCANIC_SANDSTONE))); ^ symbol: method defaultBlockState() location: variable VOLCANIC_SANDSTONE of type RegistryObject<Block> Code: public static final Block VOLCANIC_SANDSTONE_STAIRS = register("volcanic_sandstone_stairs", new StairBlock(VOLCANIC_SANDSTONE.defaultBlockState(), BlockBehaviour.Properties.copy(VOLCANIC_SANDSTONE))); Do I need to make VolcanicSandstoneStairsBlock.class file?
May 22, 20232 yr If you are posting compiler errors, you are in the wrong place. You want a learning java forum. You also don't understand how static initalisation or suppliers/deferred access works. https://forums.minecraftforge.net/topic/122471-custom-boat-119/#comment-538014 https://forums.minecraftforge.net/topic/123532-crash-in-my-mods-fluid-setup-class-what-am-i-doing-wrong-here-solved/#comment-536786 or you can search to find the many other threads where this is discussed. The correct code uses RegistryObjects properly - something like (untested pseudo code) public static final DeferredRegister<Block> BLOCKS = ... // Use a registry object public static final RegistryObject<Block> VOLCANIC_SANDSTONE_STAIRS = BLOCKS.register("volcanic_sandstone_stairs", // deferred access to the constructor - you can't create the actual blocks until the RegisterEvent happens () -> new StairBlock( // VOLCANIC_SANDSTONE is a RegistryObject<Block>/Supplier<Block> so you use get() for the real Block. VOLCANIC_SANDSTONE.get().defaultBlockState(), BlockBehaviour.Properties.copy(VOLCANIC_SANDSTONE.get())); You will also need to make sure the VOLCANIC_SANDSTONE RegistryObject is registered with the DeferredRegister before the stairs, otherwise those get()s will fail. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
May 22, 20232 yr 4 hours ago, warjort said: You will also need to make sure the VOLCANIC_SANDSTONE RegistryObject is registered with the DeferredRegister before the stairs, otherwise those get()s will fail. Quick correction to warjort's example, you should be passing in a `Supplier<BlockState>` instead of the raw `BlockState` to support lazy loading such that the parameter is not reliant on registry order. Forge patches this constructor in.
May 22, 20232 yr 5 minutes ago, ChampionAsh5357 said: Quick correction to warjort's example, you should be passing in a `Supplier<BlockState>` instead of the raw `BlockState` to support lazy loading such that the parameter is not reliant on registry order. Forge patches this constructor in. The original poster still needs the correct order to handle the block properties getting copied from the original block. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
May 22, 20232 yr 8 minutes ago, warjort said: The original poster still needs the correct order to handle the block properties getting copied from the original block. Fair point.
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.