Added rebar concrete tile stairs. Added treated wood window sill. Added decomposition recipes for stairs and tiles. Changed stair recipe yield quantity from 9 to 6.

This commit is contained in:
stfwi 2019-03-16 12:55:19 +01:00
parent c76dd25555
commit 9f6bb3262b
24 changed files with 370 additions and 37 deletions

View file

@ -41,13 +41,15 @@ public class BlockDecor extends Block
// The config combines some aspects of blocks, allowing to define different behaviour at construction time, without excessive polymorphy.
// It's an old school flag set as it is used internally only and shall not have as littlt impact on performance as possible.
public final long config;
public static final long CFG_DEFAULT = 0x0000000000000000L; // no special config
public static final long CFG_CUTOUT = 0x0000000000000001L; // cutout rendering
public static final long CFG_HORIZIONTAL = 0x0000000000000002L; // horizontal block, affects bounding box calculation at construction time
public static final long CFG_HORIZIONTAL_PLACEMENT = 0x0000000000000004L; // placed in the horizontzal direction the player is looking when placing.
public static final long CFG_OPPOSITE_PLACEMENT = 0x0000000000000008L; // placed placed in the opposite direction of the face the player clicked.
public static final long CFG_LIGHT_VALUE_MASK = 0x00000000000000f0L; // fixed value for getLightValue()
public static final long CFG_LIGHT_VALUE_SHIFT = 4L;
public static final long CFG_DEFAULT = 0x0000000000000000L; // no special config
public static final long CFG_CUTOUT = 0x0000000000000001L; // cutout rendering
public static final long CFG_HORIZIONTAL = 0x0000000000000002L; // horizontal block, affects bounding box calculation at construction time and placement
public static final long CFG_LOOK_PLACEMENT = 0x0000000000000004L; // placed in direction the player is looking when placing.
public static final long CFG_FACING_PLACEMENT = 0x0000000000000008L; // placed on the facing the player has clicked.
public static final long CFG_OPPOSITE_PLACEMENT = 0x0000000000000020L; // placed placed in the opposite direction of the face the player clicked.
public static final long CFG_LIGHT_VALUE_MASK = 0x0000000000000f00L; // fixed value for getLightValue()
public static final long CFG_LIGHT_VALUE_SHIFT = 8L;
public BlockDecor(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound)
{

View file

@ -105,16 +105,31 @@ public class BlockDecorDirected extends BlockDecor
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{ return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING))); }
@Override
@SuppressWarnings("deprecation")
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side)
{
if(!super.canPlaceBlockOnSide(world, pos, side)) return false;
return !(((config & (CFG_HORIZIONTAL|CFG_LOOK_PLACEMENT))==(CFG_HORIZIONTAL)) && ((side==EnumFacing.UP)||(side==EnumFacing.DOWN)));
}
@Override
@SuppressWarnings("deprecation")
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
if((config & CFG_HORIZIONTAL_PLACEMENT)!=0) {
// placement in direction the player is facing
return getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
if((config & (CFG_HORIZIONTAL|CFG_LOOK_PLACEMENT)) == (CFG_HORIZIONTAL|CFG_LOOK_PLACEMENT)) {
// horizontal placement in direction the player is looking
facing = placer.getHorizontalFacing();
} else if((config & (CFG_HORIZIONTAL|CFG_LOOK_PLACEMENT)) == (CFG_HORIZIONTAL)) {
// horizontal placement on a face
facing = ((facing==EnumFacing.UP)||(facing==EnumFacing.DOWN)) ? (EnumFacing.NORTH) : facing;
} else if((config & CFG_LOOK_PLACEMENT)!=0) {
// placement in direction the player is looking, with up and down
facing = EnumFacing.getDirectionFromEntityLiving(pos, placer);
} else {
// default: placement on the face the player clicking
return getDefaultState().withProperty(FACING, ((config & CFG_OPPOSITE_PLACEMENT)==0) ? facing : facing.getOpposite());
}
if((config & CFG_OPPOSITE_PLACEMENT)!=0) facing = facing.getOpposite();
return getDefaultState().withProperty(FACING, facing);
}
}

View file

@ -46,6 +46,7 @@ public class ModBlocks
public static final BlockDecorStairs REBAR_CONCRETE_STAIRS = new BlockDecorStairs("rebar_concrete_stairs", REBAR_CONCRETE_BLOCK.getDefaultState());
public static final BlockDecorWall REBAR_CONCRETE_WALL = new BlockDecorWall("rebar_concrete_wall", BlockDecor.CFG_DEFAULT, Material.ROCK, 8f, 2000f, SoundType.STONE);
public static final BlockDecorFull REBAR_CONCRETE_TILE = new BlockDecorFull("rebar_concrete_tile", 0, Material.ROCK, 8f, 2000f, SoundType.STONE);
public static final BlockDecorStairs REBAR_CONCRETE_TILE_STAIRS = new BlockDecorStairs("rebar_concrete_tile_stairs", REBAR_CONCRETE_TILE.getDefaultState());
public static final BlockDecorWall CONCRETE_WALL = new BlockDecorWall("concrete_wall", BlockDecor.CFG_DEFAULT, Material.ROCK, 8f, 50f, SoundType.STONE);
@ -57,26 +58,26 @@ public class ModBlocks
public static final BlockDecorDirected TREATED_WOOD_POLE = new BlockDecorDirected(
"treated_wood_pole",
BlockDecor.CFG_CUTOUT,
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
);
public static final BlockDecor TREATED_WOOD_TABLE = new BlockDecor(
"treated_wood_table",
BlockDecor.CFG_CUTOUT,
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD
);
public static final BlockDecorChair TREATED_WOOD_STOOL = new BlockDecorChair(
"treated_wood_stool",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL_PLACEMENT|BlockDecor.CFG_HORIZIONTAL,
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(4.1,0,4.1, 11.8,8.8,11.8)
);
public static final BlockDecorCraftingTable TREATED_WOOD_CRAFTING_TABLE = new BlockDecorCraftingTable(
"treated_wood_crafting_table",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL_PLACEMENT|BlockDecor.CFG_HORIZIONTAL,
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(0.0,0,0, 16,15.9,16)
);
@ -88,29 +89,38 @@ public class ModBlocks
ModAuxiliaries.getPixeledAABB(5.2,5.2,15.7, 10.8,10.8,16.0)
);
public static final BlockDecorDirected TREATED_WOOD_WINDOWSILL = new BlockDecorDirected(
"treated_wood_windowsill",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_FACING_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(0.5,15,10.5, 15.5,16,16)
);
public static final BlockDecorFull IRON_SHEET_ROOF_FULLBLOCK = new BlockDecorFull("iron_sheet_roof_block", 0, Material.IRON, 1.8f, 25f, SoundType.METAL);
public static final BlockDecorStairs IRON_SHEET_ROOF = new BlockDecorStairs("iron_sheet_roof", IRON_SHEET_ROOF_FULLBLOCK.getDefaultState());
private static final Block modBlocks[] = {
SLAG_BRICK_BLOCK,
TREATED_WOOD_CRAFTING_TABLE,
CLINKER_BRICK_BLOCK,
METAL_RUNG_LADDER,
METAL_RUNG_STEPS,
TREATED_WOOD_LADDER,
CLINKER_BRICK_STAIRS,
CLINKER_BRICK_WALL,
SLAG_BRICK_BLOCK,
SLAG_BRICK_STAIRS,
TREATED_WOOD_POLE,
TREATED_WOOD_TABLE,
REBAR_CONCRETE_BLOCK,
REBAR_CONCRETE_STAIRS,
REBAR_CONCRETE_WALL,
REBAR_CONCRETE_TILE,
CLINKER_BRICK_WALL,
TREATED_WOOD_STOOL,
TREATED_WOOD_CRAFTING_TABLE,
INSET_LIGHT_IRON,
REBAR_CONCRETE_TILE_STAIRS,
CONCRETE_WALL,
PANZERGLASS_BLOCK,
CONCRETE_WALL
METAL_RUNG_LADDER,
METAL_RUNG_STEPS,
TREATED_WOOD_LADDER,
TREATED_WOOD_POLE,
TREATED_WOOD_TABLE,
TREATED_WOOD_STOOL,
TREATED_WOOD_WINDOWSILL,
INSET_LIGHT_IRON,
};
private static final Block devBlocks[] = {