Jump to content

[1.8] Stairs


localtoast9001

Recommended Posts

Stairs are easier than slabs. For complete source listing look at https://github.com/localtoast9001/forge-mods/tree/1.8.

 

How stairs work in the game

Each stair is a block derived from net.minecraft.block.BlockStairs. The base class controls collision, placement, and block state properties. The stairs block references its full cube block object for material properties. The stairs block has a lot of different variants through its block state to describe the stair's orientation. Since each variant potentially has its own model, you'll need to test all combinations.

 

Design Considerations

I originally wanted to do stairs for stained bricks. The cube block for stained bricks is one block with 16 variants for each color. In 1.7, the stairs block uses all the metadata for orientation, so I needed 16 different types of stairs. I continued this pattern in 1.8, even though BlockStairs now takes a full IBlockState in its constructor. I didn't experiment.

 

Classes you will need

A stairs block class derived from net.minecraft.block.BlockStairs - This is used for block registration and to initialize the base class with properties from the cube block. To get a block state object from the cube block, you can call block.getStateFromMeta(int metadata). metadata is 0 if your cube block has no variants.

Example:

/**
* Stained brick stairs.
*
*/
public class BlockStainedBrickStairs extends BlockStairs {
    /**
     * Initializes a new instance of the BlockStainedBrickStairs class.
     * @param block the stained bricks block.
      */
    public BlockStainedBrickStairs(
        final BlockStainedBricks block) {
        super(block.getStateFromMeta(0));

 

Block Registration

Stairs reuse the common ItemBlock class, so stairs are registered like any other normal block in your Mod's init event handler.

Example:

            BlockStainedBrickStairs stairs = new BlockStainedBrickStairs(
                stainedBrickBlocks);
            GameRegistry.registerBlock(stairs, stairs.getId());

Models

You need one blockstate file and 3 model files (normal, inner, and outer) for your stairs.

Example/template blockstate file:

{
    "variants": {
        "facing=east,half=bottom,shape=straight":  { "model": "morematerials:stained_bricks_block_black_stairs" },
        "facing=west,half=bottom,shape=straight":  { "model": "morematerials:stained_bricks_block_black_stairs", "y": 180, "uvlock": true },
        "facing=south,half=bottom,shape=straight": { "model": "morematerials:stained_bricks_block_black_stairs", "y": 90, "uvlock": true },
        "facing=north,half=bottom,shape=straight": { "model": "morematerials:stained_bricks_block_black_stairs", "y": 270, "uvlock": true },
        "facing=east,half=bottom,shape=outer_right":  { "model": "morematerials:stained_bricks_block_black_outer_stairs" },
        "facing=west,half=bottom,shape=outer_right":  { "model": "morematerials:stained_bricks_block_black_outer_stairs", "y": 180, "uvlock": true },
        "facing=south,half=bottom,shape=outer_right": { "model": "morematerials:stained_bricks_block_black_outer_stairs", "y": 90, "uvlock": true },
        "facing=north,half=bottom,shape=outer_right": { "model": "morematerials:stained_bricks_block_black_outer_stairs", "y": 270, "uvlock": true },
        "facing=east,half=bottom,shape=outer_left":  { "model": "morematerials:stained_bricks_block_black_outer_stairs", "y": 270, "uvlock": true },
        "facing=west,half=bottom,shape=outer_left":  { "model": "morematerials:stained_bricks_block_black_outer_stairs", "y": 90, "uvlock": true },
        "facing=south,half=bottom,shape=outer_left": { "model": "morematerials:stained_bricks_block_black_outer_stairs" },
        "facing=north,half=bottom,shape=outer_left": { "model": "morematerials:stained_bricks_block_black_outer_stairs", "y": 180, "uvlock": true },
        "facing=east,half=bottom,shape=inner_right":  { "model": "morematerials:stained_bricks_block_black_inner_stairs" },
        "facing=west,half=bottom,shape=inner_right":  { "model": "morematerials:stained_bricks_block_black_inner_stairs", "y": 180, "uvlock": true },
        "facing=south,half=bottom,shape=inner_right": { "model": "morematerials:stained_bricks_block_black_inner_stairs", "y": 90, "uvlock": true },
        "facing=north,half=bottom,shape=inner_right": { "model": "morematerials:stained_bricks_block_black_inner_stairs", "y": 270, "uvlock": true },
        "facing=east,half=bottom,shape=inner_left":  { "model": "morematerials:stained_bricks_block_black_inner_stairs", "y": 270, "uvlock": true },
        "facing=west,half=bottom,shape=inner_left":  { "model": "morematerials:stained_bricks_block_black_inner_stairs", "y": 90, "uvlock": true },
        "facing=south,half=bottom,shape=inner_left": { "model": "morematerials:stained_bricks_block_black_inner_stairs" },
        "facing=north,half=bottom,shape=inner_left": { "model": "morematerials:stained_bricks_block_black_inner_stairs", "y": 180, "uvlock": true },
        "facing=east,half=top,shape=straight":  { "model": "morematerials:stained_bricks_block_black_stairs", "x": 180, "uvlock": true },
        "facing=west,half=top,shape=straight":  { "model": "morematerials:stained_bricks_block_black_stairs", "x": 180, "y": 180, "uvlock": true },
        "facing=south,half=top,shape=straight": { "model": "morematerials:stained_bricks_block_black_stairs", "x": 180, "y": 90, "uvlock": true },
        "facing=north,half=top,shape=straight": { "model": "morematerials:stained_bricks_block_black_stairs", "x": 180, "y": 270, "uvlock": true },
        "facing=east,half=top,shape=outer_right":  { "model": "morematerials:stained_bricks_block_black_outer_stairs", "x": 180, "uvlock": true },
        "facing=west,half=top,shape=outer_right":  { "model": "morematerials:stained_bricks_block_black_outer_stairs", "x": 180, "y": 180, "uvlock": true },
        "facing=south,half=top,shape=outer_right": { "model": "morematerials:stained_bricks_block_black_outer_stairs", "x": 180, "y": 90, "uvlock": true },
        "facing=north,half=top,shape=outer_right": { "model": "morematerials:stained_bricks_block_black_outer_stairs", "x": 180, "y": 270, "uvlock": true },
        "facing=east,half=top,shape=outer_left":  { "model": "morematerials:stained_bricks_block_black_outer_stairs", "x": 180, "y": 90, "uvlock": true },
        "facing=west,half=top,shape=outer_left":  { "model": "morematerials:stained_bricks_block_black_outer_stairs", "x": 180, "y": 270, "uvlock": true },
        "facing=south,half=top,shape=outer_left": { "model": "morematerials:stained_bricks_block_black_outer_stairs", "x": 180, "y": 180, "uvlock": true },
        "facing=north,half=top,shape=outer_left": { "model": "morematerials:stained_bricks_block_black_outer_stairs", "x": 180, "uvlock": true },
        "facing=east,half=top,shape=inner_right":  { "model": "morematerials:stained_bricks_block_black_inner_stairs", "x": 180, "uvlock": true },
        "facing=west,half=top,shape=inner_right":  { "model": "morematerials:stained_bricks_block_black_inner_stairs", "x": 180, "y": 180, "uvlock": true },
        "facing=south,half=top,shape=inner_right": { "model": "morematerials:stained_bricks_block_black_inner_stairs", "x": 180, "y": 90, "uvlock": true },
        "facing=north,half=top,shape=inner_right": { "model": "morematerials:stained_bricks_block_black_inner_stairs", "x": 180, "y": 270, "uvlock": true },
        "facing=east,half=top,shape=inner_left":  { "model": "morematerials:stained_bricks_block_black_inner_stairs", "x": 180, "y": 90, "uvlock": true },
        "facing=west,half=top,shape=inner_left":  { "model": "morematerials:stained_bricks_block_black_inner_stairs", "x": 180, "y": 270, "uvlock": true },
        "facing=south,half=top,shape=inner_left": { "model": "morematerials:stained_bricks_block_black_inner_stairs", "x": 180, "y": 180, "uvlock": true },
        "facing=north,half=top,shape=inner_left": { "model": "morematerials:stained_bricks_block_black_inner_stairs", "x": 180, "uvlock": true }
    }
}

Normal stairs model example/template:

{
    "parent": "block/stairs",
    "textures": {
        "bottom": "morematerials:blocks/stainedbricks_black",
        "top": "morematerials:blocks/stainedbricks_black",
        "side": "morematerials:blocks/stainedbricks_black"
    }
}

Inner stairs model example/template:

{
    "parent": "block/inner_stairs",
    "textures": {
        "bottom": "morematerials:blocks/stainedbricks_black",
        "top": "morematerials:blocks/stainedbricks_black",
        "side": "morematerials:blocks/stainedbricks_black"
    }
}

Outer model example/template:

{
    "parent": "block/outer_stairs",
    "textures": {
        "bottom": "morematerials:blocks/stainedbricks_black",
        "top": "morematerials:blocks/stainedbricks_black",
        "side": "morematerials:blocks/stainedbricks_black"
    }
}

Quirks

Using Neighbor brightness - In your stairs block class, set the useNeighborBrightness property to true. Otherwise, you will get dark spots on neighboring bricks when you place the stairs.

        this.useNeighborBrightness = true;

Model Registration - Like any other block in 1.8, the model has to be registered for display as an inventory icon. There are other posts on the subject, but essentially you need to do the following:

        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(
                item,
                metadata,
                new ModelResourceLocation(
                    MODID + id,
                    "inventory"));

  • Like 1
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.

Guest
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Museumbola merupakan wadah judi online terkhusus untuk sbobet atau judi bola. Dengan daftar dan deposit menggunakan BANK BCA, Anda berkesempatan mendapatkan prediksi jitu pertandingan secara update setiap hari yang bisa anda jadikan acuan untuk bermain judi bola. Hanya dengan 10 ribu rupiah dan anda bermain Mix Parlay menggunakan prediksi yang telah di sediakan oleh kami, anda akan memenangkan jutaan rupiah. Yuk segera klik DAFTAR sekarang juga.
    • I was just trying to play my modded world when i randomly got this crash for no reason. I sorted through like every mod and eventually I realized it was LLibrary but I can't seem to find a solution to fix the crashing. I can't lose the world that I have that uses this mod please help me. Here's the report: https://pastebin.com/0D00B79i If anyone has a solution please let me know.  
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ligawin88 adalah bocoran slot rekomendasi gacor dari Ligawin88 yang bisa anda temukan di SLOT Ligawin88. Situs SLOT Ligawin88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ligawin88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ligawin88 merupakan SLOT Ligawin88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ligawin88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ligawin88 hari ini yang telah disediakan SLOT Ligawin88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ligawin88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ligawin88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ligawin88 di link SLOT Ligawin88.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Asusslot adalah bocoran slot rekomendasi gacor dari Asusslot yang bisa anda temukan di SLOT Asusslot. Situs SLOT Asusslot hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Asusslot terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Asusslot merupakan SLOT Asusslot hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Asusslot. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Asusslot hari ini yang telah disediakan SLOT Asusslot. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Asusslot terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Asusslot terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Asusslot di link SLOT Asusslot.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Galeri555 adalah bocoran slot rekomendasi gacor dari Galeri555 yang bisa anda temukan di SLOT Galeri555. Situs SLOT Galeri555 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Galeri555 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Galeri555 merupakan SLOT Galeri555 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Galeri555. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Galeri555 hari ini yang telah disediakan SLOT Galeri555. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Galeri555 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Galeri555 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Galeri555 di link SLOT Galeri555.
  • Topics

×
×
  • Create New...

Important Information

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