GyuGya_55 Posted September 3, 2019 Share Posted September 3, 2019 (edited) I need a little help to regirster a custom Stair block. I have to put something to where the null is right now, but I'm not sure what I should put there... new Custom_Stone_Stairs(null, Block.Properties.create(Material.ROCK).hardnessAndResistance(2.0f, 3.0f).lightValue(0).sound(SoundType.STONE)) Just in case you need it, here is the Stair blocks code: package com.gyugya55.minecraftplus.blocks.buildingblocks; import net.minecraft.block.BlockState; import net.minecraft.block.StairsBlock; public class Custom_Stone_Stairs extends StairsBlock { public Custom_Stone_Stairs(BlockState state, Properties properties) { super(state, properties); setRegistryName("custom_stone_stairs"); } } I would really appreciate your help. Edited September 3, 2019 by GyuGya_55 Quote Link to comment Share on other sites More sharing options...
Draco18s Posted September 3, 2019 Share Posted September 3, 2019 (edited) 43 minutes ago, GyuGya_55 said: null ? Maybe go look at what that parameter is used for? Maybe look at what other places call the stairs constructor and see what they pass? Edited September 3, 2019 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
GyuGya_55 Posted September 3, 2019 Author Share Posted September 3, 2019 I should give a BlockState type and it will use it after that. This is the code in the StairsBlock class, which I extended with my Custom_Stone_Stairs class. protected StairsBlock(BlockState state, Block.Properties properties) { super(properties); this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH).with(HALF, Half.BOTTOM).with(SHAPE, StairsShape.STRAIGHT).with(WATERLOGGED, Boolean.valueOf(false))); this.modelBlock = state.getBlock(); this.modelState = state; } Quote Link to comment Share on other sites More sharing options...
Draco18s Posted September 3, 2019 Share Posted September 3, 2019 35 minutes ago, GyuGya_55 said: this.modelBlock = state.getBlock(); this.modelState = state; Great, what are these fields used for? Have you figured out what you need to pass in yet? Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
GyuGya_55 Posted September 3, 2019 Author Share Posted September 3, 2019 I managed to figure it out but I had to redo the most of my project. I had to make a new block as well and I used it like this: new Custom_Stone_Stairs(custom_stone.getDefaultState(), Block.Properties.from(custom_stone)) custom_stone is the name I registered it on. Also thanks for trying to help me. <: Quote Link to comment Share on other sites More sharing options...
MatsCraft1 Posted September 3, 2019 Share Posted September 3, 2019 Kind of off topic but do you know how to make the stairs become "corners"? Quote Link to comment Share on other sites More sharing options...
GyuGya_55 Posted September 4, 2019 Author Share Posted September 4, 2019 (edited) 14 hours ago, MatsCraft1 said: Kind of off topic but do you know how to make the stairs become "corners"? You don't have to do a lot. Basically you just have to copy the text from any vanilla stair blocks files and change the name and add your modId. Thats all. I also insert some code if you have any problems doing it by yourself. This was you will have a fully funcional stair block. This is the registration. I had a lot of truble here. ModBlocks: Spoiler package com.gyugya55.mymod.init; import javax.annotation.Nullable; import com.gyugya55.mymod.MyMod; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.StairsBlock; import net.minecraft.block.material.Material; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.registries.ForgeRegistries; public final class ModBlocks { public static Block plastered_stone; public static StairsBlock plastered_stone_stairs; private ModBlocks() {} public static void registerAll(RegistryEvent.Register<Block> event) { //custom_blocks custom_stone = register("custom_stone", new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(1.5f, 6f).sound(SoundType.STONE))); custom_stone_stairs = register("custom_stone_stairs", new Custom_Stone_Stairs(custom_stone.getDefaultState(), Block.Properties.from(custom_stone))) } private static <T extends Block> T register(String name, T block) { BlockItem item = new BlockItem(block, new Item.Properties().group(MyMod.ITEM_GROUP)); return register(name, block, item); } private static <T extends Block> T register(String name, T block, @Nullable BlockItem item) { ResourceLocation id = MyMod.getId(name); block.setRegistryName(id); ForgeRegistries.BLOCKS.register(block); if (item != null) { ModItems.BLOCKS_TO_REGISTER.put(name, item); } return block; } } Here is theCustom_Stone_Stairs class: Spoiler package com.gyugya55.mymod.blocks.buildingblocks; import net.minecraft.block.BlockState; import net.minecraft.block.StairsBlock; public class Custom_Stone_Stairs extends StairsBlock { public Custom_Stone_Stairs(BlockState state, Properties properties) { super(state, properties); } } And here are the assets files: Blockstate: Spoiler { "variants": { "facing=east,half=bottom,shape=straight": { "model": "mymod:block/custom_stone_stairs" }, "facing=west,half=bottom,shape=straight": { "model": "mymod:block/custom_stone_stairs", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=straight": { "model": "mymod:block/custom_stone_stairs", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=straight": { "model": "mymod:block/custom_stone_stairs", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=outer_right": { "model": "mymod:block/custom_stone_stairs_outer" }, "facing=west,half=bottom,shape=outer_right": { "model": "mymod:block/custom_stone_stairs_outer", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=outer_right": { "model": "mymod:block/custom_stone_stairs_outer", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=outer_right": { "model": "mymod:block/custom_stone_stairs_outer", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=outer_left": { "model": "mymod:block/custom_stone_stairs_outer", "y": 270, "uvlock": true }, "facing=west,half=bottom,shape=outer_left": { "model": "mymod:block/custom_stone_stairs_outer", "y": 90, "uvlock": true }, "facing=south,half=bottom,shape=outer_left": { "model": "mymod:block/custom_stone_stairs_outer" }, "facing=north,half=bottom,shape=outer_left": { "model": "mymod:block/custom_stone_stairs_outer", "y": 180, "uvlock": true }, "facing=east,half=bottom,shape=inner_right": { "model": "mymod:block/custom_stone_stairs_inner" }, "facing=west,half=bottom,shape=inner_right": { "model": "mymod:block/custom_stone_stairs_inner", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=inner_right": { "model": "mymod:block/custom_stone_stairs_inner", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=inner_right": { "model": "mymod:block/custom_stone_stairs_inner", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=inner_left": { "model": "mymod:block/custom_stone_stairs_inner", "y": 270, "uvlock": true }, "facing=west,half=bottom,shape=inner_left": { "model": "mymod:block/custom_stone_stairs_inner", "y": 90, "uvlock": true }, "facing=south,half=bottom,shape=inner_left": { "model": "mymod:block/custom_stone_stairs_inner" }, "facing=north,half=bottom,shape=inner_left": { "model": "mymod:block/custom_stone_stairs_inner", "y": 180, "uvlock": true }, "facing=east,half=top,shape=straight": { "model": "mymod:block/custom_stone_stairs", "x": 180, "uvlock": true }, "facing=west,half=top,shape=straight": { "model": "mymod:block/custom_stone_stairs", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=straight": { "model": "mymod:block/custom_stone_stairs", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=straight": { "model": "mymod:block/custom_stone_stairs", "x": 180, "y": 270, "uvlock": true }, "facing=east,half=top,shape=outer_right": { "model": "mymod:block/custom_stone_stairs_outer", "x": 180, "y": 90, "uvlock": true }, "facing=west,half=top,shape=outer_right": { "model": "mymod:block/custom_stone_stairs_outer", "x": 180, "y": 270, "uvlock": true }, "facing=south,half=top,shape=outer_right": { "model": "mymod:block/custom_stone_stairs_outer", "x": 180, "y": 180, "uvlock": true }, "facing=north,half=top,shape=outer_right": { "model": "mymod:block/custom_stone_stairs_outer", "x": 180, "uvlock": true }, "facing=east,half=top,shape=outer_left": { "model": "mymod:block/custom_stone_stairs_outer", "x": 180, "uvlock": true }, "facing=west,half=top,shape=outer_left": { "model": "mymod:block/custom_stone_stairs_outer", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=outer_left": { "model": "mymod:block/custom_stone_stairs_outer", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=outer_left": { "model": "mymod:block/custom_stone_stairs_outer", "x": 180, "y": 270, "uvlock": true }, "facing=east,half=top,shape=inner_right": { "model": "mymod:block/custom_stone_stairs_inner", "x": 180, "y": 90, "uvlock": true }, "facing=west,half=top,shape=inner_right": { "model": "mymod:block/custom_stone_stairs_inner", "x": 180, "y": 270, "uvlock": true }, "facing=south,half=top,shape=inner_right": { "model": "mymod:block/custom_stone_stairs_inner", "x": 180, "y": 180, "uvlock": true }, "facing=north,half=top,shape=inner_right": { "model": "mymod:block/custom_stone_stairs_inner", "x": 180, "uvlock": true }, "facing=east,half=top,shape=inner_left": { "model": "mymod:block/custom_stone_stairs_inner", "x": 180, "uvlock": true }, "facing=west,half=top,shape=inner_left": { "model": "mymod:block/custom_stone_stairs_inner", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=inner_left": { "model": "mymod:block/custom_stone_stairs_inner", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=inner_left": { "model": "mymod:block/custom_stone_stairs_inner", "x": 180, "y": 270, "uvlock": true } } } Models : custom_stone_stairs.json Spoiler { "parent": "block/stairs", "textures": { "bottom": "mymod:block/custom_stone_bottom", "top": "mymod:block/custom_stone_top", "side": "mymod:block/custom_stone_side" } } custom_stone_stairs_inner.json Spoiler { "parent": "block/inner_stairs", "textures": { "bottom": "mymod:block/custom_stone_bottom", "top": "mymod:block/custom_stone_top", "side": "mymod:block/custom_stone_side" } } custom_stone_stairs_outer.json Spoiler { "parent": "block/outer_stairs", "textures": { "bottom": "mymod:block/custom_stone_bottom", "top": "mymod:block/custom_stone_top", "side": "mymod:block/custom_stone_side" } } I left our the icon and the lang jsons, but I think you can do that by yourself. Edited September 4, 2019 by GyuGya_55 Quote Link to comment Share on other sites More sharing options...
Drachenbauer Posted April 16, 2020 Share Posted April 16, 2020 (edited) You don´t have to create your own StairsBlockClass. in 1.15.2 this works fine for a StairsBlock out of the vanilla yellow_concrete: public static final RegistryObject<Block> YELLOW_CONCRETE_STAIRS = BLOCKS.register("yellow_concrete_stairs", () -> new StairsBlock(YELLOW_CONCRETE, Block.Properties.create( Material.ROCK, MaterialColor.YELLOW).sound(SoundType.STONE).lightValue(0).hardnessAndResistance(1.8F))); It uses a seccond constructor in the vanilla StairsBlock-class, that wants a blockstate in a supplier as the first content.. So i created suppliers, wich contain the blockstates of the different vanilla concrete blocks. I only create a custom SlabBlock-class (that extends the vanilla one) for my glazed terracotta slabs to make them rotatable north, east, south and west (for texture-patterns). Maybe this is helpful for 1.14 too. edit: i noticed, the seccond constructor there is new in 1.15. Edited April 16, 2020 by Drachenbauer Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.