diff --git a/graphics/throne.xcf b/graphics/throne.xcf new file mode 100644 index 0000000..2e9ddac Binary files /dev/null and b/graphics/throne.xcf differ diff --git a/src/java/mmm/deco/DThroneBlock.java b/src/java/mmm/deco/DThroneBlock.java index dfa1dea..4616dcd 100644 --- a/src/java/mmm/deco/DThroneBlock.java +++ b/src/java/mmm/deco/DThroneBlock.java @@ -7,6 +7,7 @@ import mmm.utils.I_UBlockSeat; import mmm.utils.I_UColoredBlock; import mmm.utils.I_URecipeRegistrar; import mmm.utils.I_USupportBlock; +import mmm.utils.UMaths; import mmm.utils.URegistry; import mmm.utils.USeat; import net.minecraft.block.Block; @@ -29,8 +30,10 @@ import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; @@ -49,6 +52,11 @@ public class DThroneBlock public static final PropertyDirection FACING; public static final PropertyBool IS_TOP; public static final PropertyEnum< EnumDyeColor > COLOR; + + private static final AxisAlignedBB COLLISION_TOP_NORTH = UMaths.makeBlockAABB( 0 , 0 , 0 , 16 , 13 , 3 ); + private static final AxisAlignedBB COLLISION_TOP_EAST = UMaths.makeBlockAABB( 13 , 0 , 0 , 16 , 13 , 16 ); + private static final AxisAlignedBB COLLISION_TOP_SOUTH = UMaths.makeBlockAABB( 0 , 0 , 13 , 16 , 13 , 16 ); + private static final AxisAlignedBB COLLISION_TOP_WEST = UMaths.makeBlockAABB( 0 , 0 , 0 , 3 , 13 , 16 ); private static boolean dropping = false; @@ -85,6 +93,54 @@ public class DThroneBlock this.setHarvestLevel( "axe" , 0 ); } + // ************************************************************************************************* + // RENDERING AND SHAPE + // ************************************************************************************************* + + + @Override + @SideOnly( Side.CLIENT ) + public BlockRenderLayer getBlockLayer( ) + { + return BlockRenderLayer.CUTOUT_MIPPED; + } + + + @Override + public boolean isOpaqueCube( final IBlockState state ) + { + return false; + } + + + @Override + public boolean isFullCube( final IBlockState state ) + { + return false; + } + + + @Override + public AxisAlignedBB getBoundingBox( final IBlockState state , final IBlockAccess source , final BlockPos pos ) + { + if ( state.getValue( IS_TOP )) { + switch ( state.getValue( DChair.FACING ) ) { + case EAST: + return COLLISION_TOP_EAST; + case NORTH: + return COLLISION_TOP_NORTH; + case SOUTH: + return COLLISION_TOP_SOUTH; + case WEST: + return COLLISION_TOP_WEST; + default: + // TODO log problem + return FULL_BLOCK_AABB; + } + } + return FULL_BLOCK_AABB; + } + // ************************************************************************************************* // BLOCK STATE diff --git a/src/resources/assets/mmm/blockstates/deco/throne/oak.json b/src/resources/assets/mmm/blockstates/deco/throne/oak.json new file mode 100644 index 0000000..3bc3a4b --- /dev/null +++ b/src/resources/assets/mmm/blockstates/deco/throne/oak.json @@ -0,0 +1,53 @@ +{ + "forge_marker": 1 , + "defaults" : { + "textures": { + "wood": "mmm:blocks/deco/throne/oak/wood" + } + } , + "variants" : { + + "is_top" : { + "true" : { + "model": "mmm:deco/throne/top" , + "textures" : { + "front" : "mmm:blocks/deco/throne/oak/front-top" + } + } , + "false" : { + "model": "mmm:deco/throne/bottom" , + "textures" : { + "front" : "mmm:blocks/deco/throne/oak/front-bottom" , + "top" : "mmm:blocks/deco/throne/oak/bottom" + } + } + } , + + "facing" : { + "north" : { "y": 0 } , + "east" : { "y": 90 } , + "south" : { "y": 180 } , + "west" : { "y": 270 } + } , + + "color" : { + "black" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_black" } } , + "blue" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_blue" } } , + "brown" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_brown" } } , + "cyan" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_cyan" } } , + "gray" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_gray" } } , + "green" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_green" } } , + "light_blue" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_light_blue" } } , + "lime" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_lime" } } , + "magenta" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_magenta" } } , + "orange" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_orange" } } , + "pink" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_pink" } } , + "purple" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_purple" } } , + "red" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_red" } } , + "silver" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_silver" } } , + "white" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_white" } } , + "yellow" : { "textures" : { "wool" : "minecraft:blocks/wool_colored_yellow" } } + } + + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/deco/throne/bottom.json b/src/resources/assets/mmm/models/block/deco/throne/bottom.json new file mode 100644 index 0000000..b5ef56c --- /dev/null +++ b/src/resources/assets/mmm/models/block/deco/throne/bottom.json @@ -0,0 +1,145 @@ +{ + "textures" : { + "particle" : "#wood" , + "front" : "#front" , + "wool" : "#wool" + }, + + "elements": + [ + { + "from": [ 0, 5, 0 ] , + "to": [ 16 , 16, 2 ] , + "faces": { + "north": { "texture": "#wood" , "cullface": "north" } , + "south": { "texture": "#front" } , + "east": { "texture": "#wood" , "cullface": "east" } , + "west": { "texture": "#wood" , "cullface": "west" } + } + } , + + { + "from": [ 0, 9, 2 ] , + "to": [ 3 , 11, 16 ] , + "faces": { + "south": { "texture": "#front" , "cullface": "south" } , + "down": { "texture": "#wood" } , + "up": { "texture": "#top" } , + "east": { "texture": "#wood" } , + "west": { "texture": "#wood" , "cullface": "west" } + } + } , + { + "from": [ 13, 9, 2 ] , + "to": [ 16 , 11, 16 ] , + "faces": { + "south": { "texture": "#front" , "cullface": "south" } , + "down": { "texture": "#wood" } , + "up": { "texture": "#top" } , + "east": { "texture": "#wood" , "cullface": "east" } , + "west": { "texture": "#wood" } + } + } , + { + "from": [ 3, 3, 2 ] , + "to": [ 13 , 5, 15 ] , + "faces": { + "south": { "texture": "#wood" } , + "down": { "texture": "#wood" } , + "up": { "texture": "#top" } + } + } , + { + "from": [ 0, 3, 2 ] , + "to": [ 3 , 5, 16 ] , + "faces": { + "south": { "texture": "#wood" , "cullface": "south" } , + "down": { "texture": "#wood" } , + "up": { "texture": "#wood" } , + "east": { "texture": "#wood" } , + "west": { "texture": "#wood" , "cullface": "west" } + } + } , + { + "from": [ 13, 3, 2 ] , + "to": [ 16 , 5, 16 ] , + "faces": { + "south": { "texture": "#wood" , "cullface": "south" } , + "down": { "texture": "#wood" } , + "up": { "texture": "#wood" } , + "east": { "texture": "#wood" , "cullface": "east" } , + "west": { "texture": "#wood" } + } + } , + { + "from": [ 3, 3 , 15 ] , + "to": [ 13 , 4 , 16 ] , + "faces": { + "south": { "texture": "#wood" , "cullface": "south" } , + "down": { "texture": "#wood" } , + "up": { "texture": "#wood" } + } + } , + { + "from": [ 0, 0 , 0 ] , + "to": [ 16 , 5 , 3 ] , + "faces": { + "north": { "texture": "#wood" , "cullface": "north" } , + "south": { "texture": "#wood" } , + "down": { "texture": "#wood" , "cullface": "down" } , + "east": { "texture": "#wood" , "cullface": "east" } , + "west": { "texture": "#wood" , "cullface": "west" } + } + } , + { + "from": [ 0, 0 , 13 ] , + "to": [ 2 , 9 , 15 ] , + "faces": { + "north": { "texture": "#wood" } , + "south": { "texture": "#wood" } , + "east": { "texture": "#wood" } , + "west": { "texture": "#wood" , "cullface": "west" } + } + } , + { + "from": [ 14, 0 , 13 ] , + "to": [ 16 , 9 , 15 ] , + "faces": { + "north": { "texture": "#wood" } , + "south": { "texture": "#wood" } , + "east": { "texture": "#wood" , "cullface": "east" } , + "west": { "texture": "#wood" } + } + } , + + { + "from": [ 5, 5, 2 ] , + "to": [ 11 , 16 , 3 ] , + "faces" : { + "south": { "texture": "#wool" } , + "east": { "texture": "#wool" } , + "west": { "texture": "#wool" } + } + } , + { + "from": [ 5, 5, 3 ] , + "to": [ 11 , 6 , 11 ] , + "faces" : { + "up": { "texture": "#wool" } , + "south": { "texture": "#wool" } , + "east": { "texture": "#wool" } , + "west": { "texture": "#wool" } + } + } , + { + "from": [ 6, 5, 11 ] , + "to": [ 10 , 6 , 12 ] , + "faces" : { + "up": { "texture": "#wool" } , + "south": { "texture": "#wool" } , + "east": { "texture": "#wool" } , + "west": { "texture": "#wool" } + } + } + ] +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/deco/throne/top.json b/src/resources/assets/mmm/models/block/deco/throne/top.json new file mode 100644 index 0000000..73d5ffb --- /dev/null +++ b/src/resources/assets/mmm/models/block/deco/throne/top.json @@ -0,0 +1,77 @@ +{ + "textures" : { + "particle" : "#wood" , + "front" : "#front" , + "wool" : "#wool" + }, + + "elements": + [ + { + "from": [ 0, 0, 0 ] , + "to": [ 16 , 8, 2 ] , + "faces": { + "north": { "texture": "#wood" , "cullface": "north" } , + "south": { "texture": "#front" } , + "up": { "texture": "#wood" } , + "east": { "texture": "#wood" , "cullface": "east" } , + "west": { "texture": "#wood" , "cullface": "west" } + } + } , + { + "from": [ 1, 8, 0 ] , + "to": [ 15 , 10, 2 ] , + "faces": { + "north": { "texture": "#wood" , "cullface": "north" } , + "south": { "texture": "#front" } , + "up": { "texture": "#wood" } , + "east": { "texture": "#wood" } , + "west": { "texture": "#wood" } + } + } , + { + "from": [ 2, 10, 0 ] , + "to": [ 14 , 11, 2 ] , + "faces": { + "north": { "texture": "#wood" , "cullface": "north" } , + "south": { "texture": "#front" } , + "up": { "texture": "#wood" } , + "east": { "texture": "#wood" } , + "west": { "texture": "#wood" } + } + } , + { + "from": [ 3, 11, 0 ] , + "to": [ 13 , 12, 2 ] , + "faces": { + "north": { "texture": "#wood" , "cullface": "north" } , + "south": { "texture": "#front" } , + "up": { "texture": "#wood" } , + "east": { "texture": "#wood" } , + "west": { "texture": "#wood" } + } + } , + { + "from": [ 5, 12, 0 ] , + "to": [ 11 , 13, 2 ] , + "faces": { + "north": { "texture": "#wood" , "cullface": "north" } , + "south": { "texture": "#front" } , + "up": { "texture": "#wood" } , + "east": { "texture": "#wood" } , + "west": { "texture": "#wood" } + } + } , + + { + "from": [ 5, 0, 2 ] , + "to": [ 11 , 6 , 3 ] , + "faces" : { + "south": { "texture": "#wool" } , + "up": { "texture": "#wool" } , + "east": { "texture": "#wool" } , + "west": { "texture": "#wool" } + } + } + ] +} diff --git a/src/resources/assets/mmm/textures/blocks/deco/throne/oak/bottom.png b/src/resources/assets/mmm/textures/blocks/deco/throne/oak/bottom.png new file mode 100644 index 0000000..6a443ff Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/deco/throne/oak/bottom.png differ diff --git a/src/resources/assets/mmm/textures/blocks/deco/throne/oak/front-bottom.png b/src/resources/assets/mmm/textures/blocks/deco/throne/oak/front-bottom.png new file mode 100644 index 0000000..1de2a20 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/deco/throne/oak/front-bottom.png differ diff --git a/src/resources/assets/mmm/textures/blocks/deco/throne/oak/front-top.png b/src/resources/assets/mmm/textures/blocks/deco/throne/oak/front-top.png new file mode 100644 index 0000000..b0ceb20 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/deco/throne/oak/front-top.png differ diff --git a/src/resources/assets/mmm/textures/blocks/deco/throne/oak/wood.png b/src/resources/assets/mmm/textures/blocks/deco/throne/oak/wood.png new file mode 100644 index 0000000..74d919c Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/deco/throne/oak/wood.png differ