diff --git a/graphics/workbench-front.xcf b/graphics/workbench-front.xcf new file mode 100644 index 0000000..a7fcab1 Binary files /dev/null and b/graphics/workbench-front.xcf differ diff --git a/src/java/mmm/tech/base/TBMachines.java b/src/java/mmm/tech/base/TBMachines.java index 551559d..e1eee4f 100644 --- a/src/java/mmm/tech/base/TBMachines.java +++ b/src/java/mmm/tech/base/TBMachines.java @@ -2,17 +2,20 @@ package mmm.tech.base; import mmm.tech.base.alloy_furnace.TBAlloyFurnace; +import mmm.tech.base.workbench.TBWorkbench; public class TBMachines { public final TBAlloyFurnace ALLOY_FURNACE; + public final TBWorkbench WORKBENCH; public TBMachines( ) { this.ALLOY_FURNACE = new TBAlloyFurnace( ); + this.WORKBENCH = new TBWorkbench( ); } diff --git a/src/java/mmm/tech/base/alloy_furnace/TBAFBlock.java b/src/java/mmm/tech/base/alloy_furnace/TBAFBlock.java index fe199c7..bdb3650 100644 --- a/src/java/mmm/tech/base/alloy_furnace/TBAFBlock.java +++ b/src/java/mmm/tech/base/alloy_furnace/TBAFBlock.java @@ -319,7 +319,6 @@ public class TBAFBlock TBAFBlock.FACING , placer.getHorizontalFacing( ).getOpposite( ) ) , 2 ); if ( stack.hasDisplayName( ) ) { - System.err.println( "HAZ A NAME!" ); final TileEntity tileentity = worldIn.getTileEntity( pos ); if ( tileentity instanceof TBAFTileEntity ) { ( (TBAFTileEntity) tileentity ).setCustomName( stack.getDisplayName( ) ); diff --git a/src/java/mmm/tech/base/workbench/TBWorkbench.java b/src/java/mmm/tech/base/workbench/TBWorkbench.java new file mode 100644 index 0000000..5b70ccc --- /dev/null +++ b/src/java/mmm/tech/base/workbench/TBWorkbench.java @@ -0,0 +1,89 @@ +package mmm.tech.base.workbench; + + +import mmm.core.CRegistry; +import mmm.core.api.I_RecipeRegistrar; +import mmm.tech.base.alloy_furnace.TBAFBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockHorizontal; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; +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.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.registry.GameRegistry; + + + +public class TBWorkbench + extends Block + implements I_RecipeRegistrar +{ + public static final PropertyDirection FACING = BlockHorizontal.FACING; + + + public TBWorkbench( ) + { + super( Material.WOOD ); + + this.setCreativeTab( CreativeTabs.DECORATIONS ); + this.setHardness( 2.5f ); + this.setSoundType( SoundType.WOOD ); + this.setHarvestLevel( "axe" , 0 ); + + this.setDefaultState( this.blockState.getBaseState( ) // + .withProperty( TBWorkbench.FACING , EnumFacing.NORTH ) ); + + CRegistry.setIdentifiers( this , "tech" , "base" , "workbench" ); + CRegistry.addBlock( this ); + } + + + @Override + public void registerRecipes( ) + { + GameRegistry.addShapelessRecipe( new ItemStack( this ) , // + Blocks.CRAFTING_TABLE , // + Blocks.CHEST , // + Items.BOOK ); + } + + + @Override + protected BlockStateContainer createBlockState( ) + { + return new BlockStateContainer( this , TBWorkbench.FACING ); + } + + + @Override + public IBlockState getStateFromMeta( final int meta ) + { + return this.getDefaultState( ) // + .withProperty( TBWorkbench.FACING , EnumFacing.getHorizontal( meta ) ); + } + + + @Override + public int getMetaFromState( final IBlockState state ) + { + return state.getValue( TBWorkbench.FACING ).getHorizontalIndex( ); + } + + + @Override + public void onBlockPlacedBy( final World worldIn , final BlockPos pos , final IBlockState state , + final EntityLivingBase placer , final ItemStack stack ) + { + worldIn.setBlockState( pos , state.withProperty( // + TBAFBlock.FACING , placer.getHorizontalFacing( ).getOpposite( ) ) , 2 ); + } +} diff --git a/src/resources/assets/mmm/blockstates/tech/base/workbench.json b/src/resources/assets/mmm/blockstates/tech/base/workbench.json new file mode 100644 index 0000000..d83f06f --- /dev/null +++ b/src/resources/assets/mmm/blockstates/tech/base/workbench.json @@ -0,0 +1,8 @@ +{ + "variants": { + "facing=north": { "model": "mmm:tech/base/workbench" } , + "facing=east": { "model": "mmm:tech/base/workbench" , "y": 90 } , + "facing=south": { "model": "mmm:tech/base/workbench" , "y": 180 } , + "facing=west": { "model": "mmm:tech/base/workbench" , "y": 270 } + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/tech/base/workbench.json b/src/resources/assets/mmm/models/block/tech/base/workbench.json new file mode 100644 index 0000000..e0c5c6f --- /dev/null +++ b/src/resources/assets/mmm/models/block/tech/base/workbench.json @@ -0,0 +1,13 @@ +{ + "parent": "minecraft:block/cube", + "textures": + { + "particle": "mmm:blocks/tech/base/workbench", + "down": "minecraft:blocks/planks_oak", + "up": "minecraft:blocks/crafting_table_top", + "north": "mmm:blocks/tech/base/workbench", + "west": "minecraft:blocks/crafting_table_front", + "east": "minecraft:blocks/crafting_table_side", + "south": "minecraft:blocks/crafting_table_side" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/tech/base/workbench.json b/src/resources/assets/mmm/models/item/tech/base/workbench.json new file mode 100644 index 0000000..88d6c91 --- /dev/null +++ b/src/resources/assets/mmm/models/item/tech/base/workbench.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/tech/base/workbench" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/tech/base/workbench.png b/src/resources/assets/mmm/textures/blocks/tech/base/workbench.png new file mode 100644 index 0000000..d74f948 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/tech/base/workbench.png differ