Crafting table model changed. Mod logo changed. Added inset spot light.

This commit is contained in:
stfwi 2019-03-04 13:13:21 +01:00
parent 107ad0ffad
commit 412098c960
19 changed files with 351 additions and 81 deletions

View file

@ -41,10 +41,13 @@ 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_WALL_DOOR_CONNECTION = 0x0000000000000008L; // wall block connects to fence gates and doors.
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 BlockDecor(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound)
{
@ -56,6 +59,7 @@ public class BlockDecor extends Block
setHardness((hardness > 0) ? hardness : 5.0f);
setResistance((resistance > 0) ? resistance : 10.0f);
setSoundType((sound==null) ? SoundType.STONE : sound);
setLightOpacity(0);
this.config = config;
}
@ -148,6 +152,10 @@ public class BlockDecor extends Block
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
{}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{ return (int)((config & CFG_LIGHT_VALUE_MASK) >> CFG_LIGHT_VALUE_SHIFT); }
@Override
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side)
{ return super.canPlaceBlockOnSide(world, pos, side); }

View file

@ -114,7 +114,7 @@ public class BlockDecorDirected extends BlockDecor
return getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
} else {
// default: placement on the face the player clicking
return getDefaultState().withProperty(FACING, facing);
return getDefaultState().withProperty(FACING, ((config & CFG_OPPOSITE_PLACEMENT)==0) ? facing : facing.getOpposite());
}
}
}

View file

@ -44,16 +44,16 @@ public class ModBlocks
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 BlockDecorLadder METAL_RUNG_LADDER = new BlockDecorLadder("metal_rung_ladder", 0, Material.IRON, 1.8f, 25f, SoundType.METAL);
public static final BlockDecorLadder METAL_RUNG_STEPS = new BlockDecorLadder("metal_rung_steps", 0, Material.IRON, 1.8f, 25f, SoundType.METAL);
public static final BlockDecorLadder METAL_RUNG_LADDER = new BlockDecorLadder("metal_rung_ladder", 0, Material.IRON, 1.0f, 25f, SoundType.METAL);
public static final BlockDecorLadder METAL_RUNG_STEPS = new BlockDecorLadder("metal_rung_steps", 0, Material.IRON, 1.0f, 25f, SoundType.METAL);
public static final BlockDecorLadder TREATED_WOOD_LADDER = new BlockDecorLadder("treated_wood_ladder", 0, Material.WOOD, 1.0f, 15f, SoundType.WOOD);
public static final BlockDecorFull REBAR_CONCRETE_BLOCK = new BlockDecorFull("rebar_concrete", 0, Material.ROCK, 8f, 2000f, SoundType.STONE);
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_WALL_DOOR_CONNECTION, Material.ROCK, 8f, 2000f, SoundType.STONE);
public static final BlockDecorWall REBAR_CONCRETE_WALL = new BlockDecorWall("rebar_concrete_wall", BlockDecor.CFG_DEFAULT, Material.ROCK, 8f, 2000f, SoundType.STONE);
public static final BlockDecorWall CONCRETE_WALL = new BlockDecorWall("concrete_wall", BlockDecor.CFG_WALL_DOOR_CONNECTION, Material.ROCK, 8f, 50f, SoundType.STONE);
public static final BlockDecorWall CLINKER_BRICK_WALL = new BlockDecorWall("clinker_brick_wall", BlockDecor.CFG_WALL_DOOR_CONNECTION, Material.ROCK, 8f, 50f, SoundType.STONE);
public static final BlockDecorWall CONCRETE_WALL = new BlockDecorWall("concrete_wall", BlockDecor.CFG_DEFAULT, Material.ROCK, 8f, 50f, SoundType.STONE);
public static final BlockDecorWall CLINKER_BRICK_WALL = new BlockDecorWall("clinker_brick_wall", BlockDecor.CFG_DEFAULT, Material.ROCK, 8f, 50f, SoundType.STONE);
public static final BlockDecorDirected TREATED_WOOD_POLE = new BlockDecorDirected(
"treated_wood_pole",
@ -78,10 +78,15 @@ public class ModBlocks
"treated_wood_crafting_table",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL_PLACEMENT|BlockDecor.CFG_HORIZIONTAL,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(0.5,0,3, 15.5,15.125,15.5)
ModAuxiliaries.getPixeledAABB(0.0,0,0, 16,15.9,16)
);
public static final BlockDecorDirected INSET_LIGHT_IRON = new BlockDecorDirected(
"iron_inset_light",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_OPPOSITE_PLACEMENT|(14<<BlockDecor.CFG_LIGHT_VALUE_SHIFT),
Material.IRON, 1.0f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(5.2,5.2,15.7, 10.8,10.8,16.0)
);
public static final BlockDecorStairs IRON_SHEET_ROOF = new BlockDecorStairs("iron_sheet_roof", IRON_SHEET_ROOF_FULLBLOCK.getDefaultState());
@ -101,6 +106,7 @@ public class ModBlocks
CLINKER_BRICK_WALL,
TREATED_WOOD_STOOL,
TREATED_WOOD_CRAFTING_TABLE,
INSET_LIGHT_IRON,
};
private static final Block ieDependentBlocks[] = {