diff --git a/src/java/mmm/tech/base/TBAlloyFurnaceBlock.java b/src/java/mmm/tech/base/TBAlloyFurnaceBlock.java index 2f3a342..ff1745f 100644 --- a/src/java/mmm/tech/base/TBAlloyFurnaceBlock.java +++ b/src/java/mmm/tech/base/TBAlloyFurnaceBlock.java @@ -1,11 +1,12 @@ package mmm.tech.base; +import java.util.List; import java.util.Random; import javax.annotation.Nullable; -import mmm.utils.I_USupportBlock; +import mmm.utils.UMaths; import mmm.utils.URegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; @@ -16,17 +17,21 @@ import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -36,6 +41,9 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TBAlloyFurnaceBlock extends BlockContainer { + private static final AxisAlignedBB AABB_BOTTOM = UMaths.makeBlockAABB( 0 , 0 , 0 , 16 , 10 , 16 ); + private static final AxisAlignedBB AABB_TOP = UMaths.makeBlockAABB( 4 , 10 , 4 , 12 , 16 , 12 ); + public static final PropertyDirection FACING = BlockHorizontal.FACING; public final boolean active; @@ -49,6 +57,9 @@ public class TBAlloyFurnaceBlock this.setResistance( 17.5f ); this.setHardness( 3.5f ); this.setHarvestLevel( "pickaxe" , 0 ); + this.lightOpacity = 0; + this.translucent = false; + this.fullBlock = false; URegistry.setIdentifiers( this , "tech" , "base" , "alloy_furnace" , active ? "active" : "inactive" ); } @@ -65,7 +76,7 @@ public class TBAlloyFurnaceBlock // ************************************************************************************************* - // RENDERING + // RENDERING AND COLLISIONS // ************************************************************************************************* @Override @@ -82,6 +93,13 @@ public class TBAlloyFurnaceBlock } + @Override + public EnumBlockRenderType getRenderType( final IBlockState state ) + { + return EnumBlockRenderType.MODEL; + } + + @Override @SideOnly( Side.CLIENT ) public BlockRenderLayer getBlockLayer( ) @@ -141,6 +159,22 @@ public class TBAlloyFurnaceBlock } + @Override + public AxisAlignedBB getBoundingBox( final IBlockState state , final IBlockAccess source , final BlockPos pos ) + { + return Block.FULL_BLOCK_AABB; + } + + + @Override + public void addCollisionBoxToList( final IBlockState state , final World worldIn , final BlockPos pos , + final AxisAlignedBB entityBox , final List< AxisAlignedBB > collidingBoxes , final Entity entityIn ) + { + Block.addCollisionBoxToList( pos , entityBox , collidingBoxes , TBAlloyFurnaceBlock.AABB_TOP ); + Block.addCollisionBoxToList( pos , entityBox , collidingBoxes , TBAlloyFurnaceBlock.AABB_BOTTOM ); + } + + // ************************************************************************************************* // ITEM // ************************************************************************************************* @@ -215,17 +249,10 @@ public class TBAlloyFurnaceBlock // ************************************************************************************************* @Override - public void neighborChanged( final IBlockState state , final World worldIn , final BlockPos pos , - final Block blockIn ) + public boolean isSideSolid( final IBlockState base_state , final IBlockAccess world , final BlockPos pos , + final EnumFacing side ) { - I_USupportBlock.dropIfUnsupported( state , worldIn , pos , this ); - } - - - @Override - public boolean canPlaceBlockAt( final World worldIn , final BlockPos pos ) - { - return super.canPlaceBlockAt( worldIn , pos ) && I_USupportBlock.check( worldIn , pos ); + return side == EnumFacing.DOWN; } } diff --git a/src/resources/assets/mmm/blockstates/tech/base/alloy_furnace/active.json b/src/resources/assets/mmm/blockstates/tech/base/alloy_furnace/active.json new file mode 100644 index 0000000..058068e --- /dev/null +++ b/src/resources/assets/mmm/blockstates/tech/base/alloy_furnace/active.json @@ -0,0 +1,8 @@ +{ + "variants": { + "facing=north": { "model": "mmm:tech/base/alloy_furnace/active" }, + "facing=east": { "model": "mmm:tech/base/alloy_furnace/active", "y": 90 }, + "facing=south": { "model": "mmm:tech/base/alloy_furnace/active", "y": 180 }, + "facing=west": { "model": "mmm:tech/base/alloy_furnace/active", "y": 270 } + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/blockstates/tech/base/alloy_furnace/inactive.json b/src/resources/assets/mmm/blockstates/tech/base/alloy_furnace/inactive.json new file mode 100644 index 0000000..85abbcb --- /dev/null +++ b/src/resources/assets/mmm/blockstates/tech/base/alloy_furnace/inactive.json @@ -0,0 +1,8 @@ +{ + "variants": { + "facing=north": { "model": "mmm:tech/base/alloy_furnace/inactive" }, + "facing=east": { "model": "mmm:tech/base/alloy_furnace/inactive", "y": 90 }, + "facing=south": { "model": "mmm:tech/base/alloy_furnace/inactive", "y": 180 }, + "facing=west": { "model": "mmm:tech/base/alloy_furnace/inactive", "y": 270 } + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/tech/base/alloy_furnace.json b/src/resources/assets/mmm/models/block/tech/base/alloy_furnace.json new file mode 100644 index 0000000..068395d --- /dev/null +++ b/src/resources/assets/mmm/models/block/tech/base/alloy_furnace.json @@ -0,0 +1,72 @@ +{ + "textures": + { + "side": "mmm:blocks/tech/base/alloy_furnace/side", + "bottom": "mmm:blocks/tech/base/alloy_furnace/bottom", + "particle": "minecraft:blocks/brick" + }, + + "elements": + [ + { + "from": [0, 0, 0] , + "to": [16, 10, 16] , + "faces": { + "down": { "texture": "#bottom", "cullface": "down" }, + "up": { "texture": "#top" }, + "north": { "texture": "#front", "cullface": "north" } , + "south": { "texture": "#side", "cullface": "south" } , + "east": { "texture": "#side", "cullface": "east" } , + "west": { "texture": "#side", "cullface": "west" } + } + } , + + { + "from": [4, 10, 4], + "to": [5, 16, 12], + "faces": { + "up": { "texture": "#top", "cullface": "up" }, + "north": { "texture": "#front" } , + "south": { "texture": "#side" } , + "east": { "texture": "#side" } , + "west": { "texture": "#side" } + } + } , + { + "from": [11, 10, 4], + "to": [12, 16, 12], + "faces": { + "up": { "texture": "#top", "cullface": "up" }, + "north": { "texture": "#front" } , + "south": { "texture": "#side" } , + "east": { "texture": "#side" } , + "west": { "texture": "#side" } + } + } , + { + "from": [5, 10, 4], + "to": [11, 16, 5], + "faces": { + "up": { "texture": "#top", "cullface": "up" }, + "north": { "texture": "#front" } , + "south": { "texture": "#side" } + } + } , + { + "from": [5, 10, 11], + "to": [11, 16, 12], + "faces": { + "up": { "texture": "#top", "cullface": "up" }, + "north": { "texture": "#front" } , + "south": { "texture": "#side" } + } + } , + { + "from": [5, 15, 5] , + "to": [11, 15, 11] , + "faces": { + "up": { "texture": "#top", "cullface": "up" } + } + } + ] +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/tech/base/alloy_furnace/active.json b/src/resources/assets/mmm/models/block/tech/base/alloy_furnace/active.json new file mode 100644 index 0000000..3661526 --- /dev/null +++ b/src/resources/assets/mmm/models/block/tech/base/alloy_furnace/active.json @@ -0,0 +1,8 @@ +{ + "parent": "mmm:block/tech/base/alloy_furnace", + "textures": + { + "top": "mmm:blocks/tech/base/alloy_furnace/active/top", + "front": "mmm:blocks/tech/base/alloy_furnace/active/front" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/tech/base/alloy_furnace/inactive.json b/src/resources/assets/mmm/models/block/tech/base/alloy_furnace/inactive.json new file mode 100644 index 0000000..47a1e81 --- /dev/null +++ b/src/resources/assets/mmm/models/block/tech/base/alloy_furnace/inactive.json @@ -0,0 +1,8 @@ +{ + "parent": "mmm:block/tech/base/alloy_furnace", + "textures": + { + "top": "mmm:blocks/tech/base/alloy_furnace/inactive/top", + "front": "mmm:blocks/tech/base/alloy_furnace/inactive/front" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/tech/base/alloy_furnace.json b/src/resources/assets/mmm/models/item/tech/base/alloy_furnace.json new file mode 100644 index 0000000..7b52340 --- /dev/null +++ b/src/resources/assets/mmm/models/item/tech/base/alloy_furnace.json @@ -0,0 +1,25 @@ +{ + "parent": "mmm:block/tech/base/alloy_furnace/inactive", + "display": { + "thirdperson_righthand": { + "rotation": [ 10, -45, 10 ], + "translation": [ 0, 1.5, -1.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + }, + "firstperson_righthand": { + "rotation": [ 10, -45, 10 ], + "translation": [ 0, 1.5, -1.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + }, + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 1, 0 ], + "scale": [ 0.375, 0.375, 0.375 ] + }, + "gui": { + "rotation": [ 30, 45, 0 ], + "translation": [ 0, 0, 0 ], + "scale": [ 0.5, 0.5, 0.5 ] + } + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/active/front.png b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/active/front.png new file mode 100644 index 0000000..73def24 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/active/front.png differ diff --git a/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/active/top.png b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/active/top.png new file mode 100644 index 0000000..a2e8e74 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/active/top.png differ diff --git a/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/bottom.png b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/bottom.png new file mode 100644 index 0000000..821e549 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/bottom.png differ diff --git a/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/inactive/front.png b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/inactive/front.png new file mode 100644 index 0000000..7bb102b Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/inactive/front.png differ diff --git a/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/inactive/top.png b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/inactive/top.png new file mode 100644 index 0000000..2bad437 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/inactive/top.png differ diff --git a/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/side.png b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/side.png new file mode 100644 index 0000000..adf1298 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/tech/base/alloy_furnace/side.png differ