Skip to content

Commit

Permalink
Implement custom stairs
Browse files Browse the repository at this point in the history
  • Loading branch information
IcarussOne committed Mar 1, 2024
1 parent 778098e commit 2008990
Show file tree
Hide file tree
Showing 18 changed files with 642 additions and 2 deletions.
40 changes: 40 additions & 0 deletions src/main/java/drzhark/mocreatures/block/MoCBlockStairs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package drzhark.mocreatures.block;

import net.minecraft.block.BlockStairs;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;

public class MoCBlockStairs extends BlockStairs {
public boolean flammable;

public MoCBlockStairs(IBlockState state, boolean flammable) {
super(state);
this.useNeighborBrightness = true;
this.flammable = flammable;
}

public boolean isFlammable() {
return flammable;
}

@Override
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
if (isFlammable()) {
return Blocks.PLANKS.getFlammability(world, pos, face);
} else {
return 0;
}
}

@Override
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
if (isFlammable()) {
return Blocks.PLANKS.getFireSpreadSpeed(world, pos, face);
} else {
return 0;
}
}
}
28 changes: 26 additions & 2 deletions src/main/java/drzhark/mocreatures/init/MoCBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,34 @@ public class MoCBlocks {
public static Block carvedSilverSandstone;
@GameRegistry.ObjectHolder("cobbled_wyvstone")
public static Block cobbledWyvstone;
@GameRegistry.ObjectHolder("cobbled_wyvstone_stairs")
public static MoCBlockStairs cobbledWyvstoneStairs;
@GameRegistry.ObjectHolder("cobbled_deep_wyvstone")
public static Block cobbledDeepWyvstone;
@GameRegistry.ObjectHolder("cobbled_deep_wyvstone_stairs")
public static MoCBlockStairs cobbledDeepWyvstoneStairs;
@GameRegistry.ObjectHolder("deep_wyvstone")
public static Block deepWyvstone;
@GameRegistry.ObjectHolder("deep_wyvstone_stairs")
public static Block deepWyvstoneStairs;
@GameRegistry.ObjectHolder("firestone")
public static Block firestone;
@GameRegistry.ObjectHolder("gleaming_glass")
public static Block gleamingGlass;
@GameRegistry.ObjectHolder("mossy_cobbled_wyvstone")
public static Block mossyCobbledWyvstone;
@GameRegistry.ObjectHolder("mossy_cobbled_wyvstone_stairs")
public static Block mossyCobbledWyvstoneStairs;
@GameRegistry.ObjectHolder("mossy_cobbled_deep_wyvstone")
public static Block mossyCobbledDeepWyvstone;
@GameRegistry.ObjectHolder("mossy_cobbled_deep_wyvstone_stairs")
public static Block mossyCobbledDeepWyvstoneStairs;
@GameRegistry.ObjectHolder("silver_sand")
public static Block silverSand;
@GameRegistry.ObjectHolder("silver_sandstone")
public static Block silverSandstone;
@GameRegistry.ObjectHolder("silver_sandstone_stairs")
public static Block silverSandstoneStairs;
@GameRegistry.ObjectHolder("smooth_silver_sandstone")
public static Block smoothSilverSandstone;
@GameRegistry.ObjectHolder("tall_wyvgrass")
Expand All @@ -75,6 +87,8 @@ public class MoCBlocks {
public static MoCBlockNest wyvernNestBlock;
@GameRegistry.ObjectHolder("wyvstone")
public static Block wyvstone;
@GameRegistry.ObjectHolder("wyvstone_stairs")
public static Block wyvstoneStairs;
@GameRegistry.ObjectHolder("wyvgrass")
public static Block wyvgrass;
@GameRegistry.ObjectHolder("wyvdirt")
Expand All @@ -87,20 +101,29 @@ public class MoCBlocks {
public static Block wyvwoodLog;
@GameRegistry.ObjectHolder("wyvwood_planks")
public static Block wyvwoodPlanks;
@GameRegistry.ObjectHolder("wyvwood_stairs")
public static Block wyvwoodPlanksStairs;

@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
event.getRegistry().registerAll(
setup(new MoCBlockMetal(MapColor.IRON), "ancient_silver_block").setHardness(3.0F).setResistance(10.0F),
setup(new MoCBlockRock(MapColor.STONE), "cobbled_wyvstone").setHardness(2.0F).setResistance(10.0F),
setup(new MoCBlockStairs(new MoCBlockRock(MapColor.STONE).getDefaultState(), false), "cobbled_wyvstone_stairs").setHardness(2.0F).setResistance(10.0F),
setup(new MoCBlockRock(MapColor.STONE), "cobbled_deep_wyvstone").setHardness(3.5F).setResistance(10.0F),
setup(new MoCBlockStairs(new MoCBlockRock(MapColor.STONE).getDefaultState(), false), "cobbled_deep_wyvstone_stairs").setHardness(3.5F).setResistance(10.0F),
setup(new MoCBlockRock(MapColor.STONE), "wyvstone").setHardness(1.5F).setResistance(10.0F),
setup(new MoCBlockStairs(new MoCBlockRock(MapColor.STONE).getDefaultState(), false), "wyvstone_stairs").setHardness(1.5F).setResistance(10.0F),
setup(new MoCBlockRock(MapColor.STONE), "deep_wyvstone").setHardness(3.0F).setResistance(10.0F),
setup(new MoCBlockRock(MapColor.STONE), "mossy_cobbled_wyvstone").setHardness(1.5F).setResistance(10.0F),
setup(new MoCBlockRock(MapColor.STONE), "mossy_cobbled_deep_wyvstone").setHardness(1.5F).setResistance(10.0F),
setup(new MoCBlockStairs(new MoCBlockRock(MapColor.STONE).getDefaultState(), false), "deep_wyvstone_stairs").setHardness(3.0F).setResistance(10.0F),
setup(new MoCBlockRock(MapColor.STONE), "mossy_cobbled_wyvstone").setHardness(2.0F).setResistance(10.0F),
setup(new MoCBlockStairs(new MoCBlockRock(MapColor.STONE).getDefaultState(), false), "mossy_cobbled_wyvstone_stairs").setHardness(2.0F).setResistance(10.0F),
setup(new MoCBlockRock(MapColor.STONE), "mossy_cobbled_deep_wyvstone").setHardness(3.5F).setResistance(10.0F),
setup(new MoCBlockStairs(new MoCBlockRock(MapColor.STONE).getDefaultState(), false), "mossy_cobbled_deep_wyvstone_stairs").setHardness(3.5F).setResistance(10.0F),
setup(new MoCBlockGlass(), "gleaming_glass").setHardness(0.4F),
setup(new MoCBlockSand(MapColor.CLAY), "silver_sand").setHardness(0.6F),
setup(new MoCBlockRock(MapColor.CLAY), "silver_sandstone").setHardness(1.2F),
setup(new MoCBlockStairs(new MoCBlockRock(MapColor.CLAY).getDefaultState(), false), "silver_sandstone_stairs").setHardness(1.2F),
setup(new MoCBlockRock(MapColor.CLAY), "carved_silver_sandstone").setHardness(1.2F),
setup(new MoCBlockRock(MapColor.CLAY), "smooth_silver_sandstone").setHardness(1.2F),
setup(new MoCBlockOre(MapColor.STONE), "ancient_ore").setHardness(3.0F).setResistance(5.0F),
Expand All @@ -117,6 +140,7 @@ public static void registerBlocks(RegistryEvent.Register<Block> event) {
setup(new MoCBlockLog(MapColor.CYAN_STAINED_HARDENED_CLAY, true), "wyvwood_log").setHardness(2.0F),
setup(new MoCBlockTallGrass(MapColor.LIGHT_BLUE_STAINED_HARDENED_CLAY, false), "tall_wyvgrass").setHardness(0.0F),
setup(new MoCBlockPlanks(MapColor.DIAMOND, true), "wyvwood_planks").setHardness(2.0F).setResistance(5.0F),
setup(new MoCBlockStairs(new MoCBlockPlanks(MapColor.DIAMOND, true).getDefaultState(), true), "wyvwood_stairs").setHardness(2.0F).setResistance(5.0F),
setup(new MoCBlockNest(), "wyvern_nest_block").setHardness(0.5F)
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"forge_marker": 1,
"defaults": {
"model": "stairs",
"textures": {
"bottom": "mocreatures:blocks/cobblestone_wyvern_deep",
"top": "mocreatures:blocks/cobblestone_wyvern_deep",
"side": "mocreatures:blocks/cobblestone_wyvern_deep"
}
},
"variants": {
"normal": [{}],
"inventory": [{}],
"facing=east,half=bottom,shape=straight": {"model": "stairs"},
"facing=west,half=bottom,shape=straight": {"model": "stairs", "y": 180, "uvlock": true},
"facing=south,half=bottom,shape=straight": {"model": "stairs", "y": 90, "uvlock": true},
"facing=north,half=bottom,shape=straight": {"model": "stairs", "y": 270, "uvlock": true},
"facing=east,half=bottom,shape=outer_right": {"model": "outer_stairs"},
"facing=west,half=bottom,shape=outer_right": {"model": "outer_stairs", "y": 180, "uvlock": true},
"facing=south,half=bottom,shape=outer_right": {"model": "outer_stairs", "y": 90, "uvlock": true},
"facing=north,half=bottom,shape=outer_right": {"model": "outer_stairs", "y": 270, "uvlock": true},
"facing=east,half=bottom,shape=outer_left": {"model": "outer_stairs", "y": 270, "uvlock": true},
"facing=west,half=bottom,shape=outer_left": {"model": "outer_stairs", "y": 90, "uvlock": true},
"facing=south,half=bottom,shape=outer_left": {"model": "outer_stairs"},
"facing=north,half=bottom,shape=outer_left": {"model": "outer_stairs", "y": 180, "uvlock": true},
"facing=east,half=bottom,shape=inner_right": {"model": "inner_stairs"},
"facing=west,half=bottom,shape=inner_right": {"model": "inner_stairs", "y": 180, "uvlock": true},
"facing=south,half=bottom,shape=inner_right": {"model": "inner_stairs", "y": 90, "uvlock": true},
"facing=north,half=bottom,shape=inner_right": {"model": "inner_stairs", "y": 270, "uvlock": true},
"facing=east,half=bottom,shape=inner_left": {"model": "inner_stairs", "y": 270, "uvlock": true},
"facing=west,half=bottom,shape=inner_left": {"model": "inner_stairs", "y": 90, "uvlock": true},
"facing=south,half=bottom,shape=inner_left": {"model": "inner_stairs"},
"facing=north,half=bottom,shape=inner_left": {"model": "inner_stairs", "y": 180, "uvlock": true},
"facing=east,half=top,shape=straight": {"model": "stairs", "x": 180, "uvlock": true},
"facing=west,half=top,shape=straight": {"model": "stairs", "x": 180, "y": 180, "uvlock": true},
"facing=south,half=top,shape=straight": {"model": "stairs", "x": 180, "y": 90, "uvlock": true},
"facing=north,half=top,shape=straight": {"model": "stairs", "x": 180, "y": 270, "uvlock": true},
"facing=east,half=top,shape=outer_right": {"model": "outer_stairs", "x": 180, "y": 90, "uvlock": true},
"facing=west,half=top,shape=outer_right": {"model": "outer_stairs", "x": 180, "y": 270, "uvlock": true},
"facing=south,half=top,shape=outer_right": {"model": "outer_stairs", "x": 180, "y": 180, "uvlock": true},
"facing=north,half=top,shape=outer_right": {"model": "outer_stairs", "x": 180, "uvlock": true},
"facing=east,half=top,shape=outer_left": {"model": "outer_stairs", "x": 180, "uvlock": true},
"facing=west,half=top,shape=outer_left": {"model": "outer_stairs", "x": 180, "y": 180, "uvlock": true},
"facing=south,half=top,shape=outer_left": {"model": "outer_stairs", "x": 180, "y": 90, "uvlock": true},
"facing=north,half=top,shape=outer_left": {"model": "outer_stairs", "x": 180, "y": 270, "uvlock": true},
"facing=east,half=top,shape=inner_right": {"model": "inner_stairs", "x": 180, "y": 90, "uvlock": true},
"facing=west,half=top,shape=inner_right": {"model": "inner_stairs", "x": 180, "y": 270, "uvlock": true},
"facing=south,half=top,shape=inner_right": {"model": "inner_stairs", "x": 180, "y": 180, "uvlock": true},
"facing=north,half=top,shape=inner_right": {"model": "inner_stairs", "x": 180, "uvlock": true},
"facing=east,half=top,shape=inner_left": {"model": "inner_stairs", "x": 180, "uvlock": true},
"facing=west,half=top,shape=inner_left": {"model": "inner_stairs", "x": 180, "y": 180, "uvlock": true},
"facing=south,half=top,shape=inner_left": {"model": "inner_stairs", "x": 180, "y": 90, "uvlock": true},
"facing=north,half=top,shape=inner_left": {"model": "inner_stairs", "x": 180, "y": 270, "uvlock": true}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"forge_marker": 1,
"defaults": {
"model": "stairs",
"textures": {
"bottom": "mocreatures:blocks/cobblestone_wyvern",
"top": "mocreatures:blocks/cobblestone_wyvern",
"side": "mocreatures:blocks/cobblestone_wyvern"
}
},
"variants": {
"normal": [{}],
"inventory": [{}],
"facing=east,half=bottom,shape=straight": {"model": "stairs"},
"facing=west,half=bottom,shape=straight": {"model": "stairs", "y": 180, "uvlock": true},
"facing=south,half=bottom,shape=straight": {"model": "stairs", "y": 90, "uvlock": true},
"facing=north,half=bottom,shape=straight": {"model": "stairs", "y": 270, "uvlock": true},
"facing=east,half=bottom,shape=outer_right": {"model": "outer_stairs"},
"facing=west,half=bottom,shape=outer_right": {"model": "outer_stairs", "y": 180, "uvlock": true},
"facing=south,half=bottom,shape=outer_right": {"model": "outer_stairs", "y": 90, "uvlock": true},
"facing=north,half=bottom,shape=outer_right": {"model": "outer_stairs", "y": 270, "uvlock": true},
"facing=east,half=bottom,shape=outer_left": {"model": "outer_stairs", "y": 270, "uvlock": true},
"facing=west,half=bottom,shape=outer_left": {"model": "outer_stairs", "y": 90, "uvlock": true},
"facing=south,half=bottom,shape=outer_left": {"model": "outer_stairs"},
"facing=north,half=bottom,shape=outer_left": {"model": "outer_stairs", "y": 180, "uvlock": true},
"facing=east,half=bottom,shape=inner_right": {"model": "inner_stairs"},
"facing=west,half=bottom,shape=inner_right": {"model": "inner_stairs", "y": 180, "uvlock": true},
"facing=south,half=bottom,shape=inner_right": {"model": "inner_stairs", "y": 90, "uvlock": true},
"facing=north,half=bottom,shape=inner_right": {"model": "inner_stairs", "y": 270, "uvlock": true},
"facing=east,half=bottom,shape=inner_left": {"model": "inner_stairs", "y": 270, "uvlock": true},
"facing=west,half=bottom,shape=inner_left": {"model": "inner_stairs", "y": 90, "uvlock": true},
"facing=south,half=bottom,shape=inner_left": {"model": "inner_stairs"},
"facing=north,half=bottom,shape=inner_left": {"model": "inner_stairs", "y": 180, "uvlock": true},
"facing=east,half=top,shape=straight": {"model": "stairs", "x": 180, "uvlock": true},
"facing=west,half=top,shape=straight": {"model": "stairs", "x": 180, "y": 180, "uvlock": true},
"facing=south,half=top,shape=straight": {"model": "stairs", "x": 180, "y": 90, "uvlock": true},
"facing=north,half=top,shape=straight": {"model": "stairs", "x": 180, "y": 270, "uvlock": true},
"facing=east,half=top,shape=outer_right": {"model": "outer_stairs", "x": 180, "y": 90, "uvlock": true},
"facing=west,half=top,shape=outer_right": {"model": "outer_stairs", "x": 180, "y": 270, "uvlock": true},
"facing=south,half=top,shape=outer_right": {"model": "outer_stairs", "x": 180, "y": 180, "uvlock": true},
"facing=north,half=top,shape=outer_right": {"model": "outer_stairs", "x": 180, "uvlock": true},
"facing=east,half=top,shape=outer_left": {"model": "outer_stairs", "x": 180, "uvlock": true},
"facing=west,half=top,shape=outer_left": {"model": "outer_stairs", "x": 180, "y": 180, "uvlock": true},
"facing=south,half=top,shape=outer_left": {"model": "outer_stairs", "x": 180, "y": 90, "uvlock": true},
"facing=north,half=top,shape=outer_left": {"model": "outer_stairs", "x": 180, "y": 270, "uvlock": true},
"facing=east,half=top,shape=inner_right": {"model": "inner_stairs", "x": 180, "y": 90, "uvlock": true},
"facing=west,half=top,shape=inner_right": {"model": "inner_stairs", "x": 180, "y": 270, "uvlock": true},
"facing=south,half=top,shape=inner_right": {"model": "inner_stairs", "x": 180, "y": 180, "uvlock": true},
"facing=north,half=top,shape=inner_right": {"model": "inner_stairs", "x": 180, "uvlock": true},
"facing=east,half=top,shape=inner_left": {"model": "inner_stairs", "x": 180, "uvlock": true},
"facing=west,half=top,shape=inner_left": {"model": "inner_stairs", "x": 180, "y": 180, "uvlock": true},
"facing=south,half=top,shape=inner_left": {"model": "inner_stairs", "x": 180, "y": 90, "uvlock": true},
"facing=north,half=top,shape=inner_left": {"model": "inner_stairs", "x": 180, "y": 270, "uvlock": true}
}
}
Loading

0 comments on commit 2008990

Please sign in to comment.