Alloy furnace - Appearance

+ No longer requires a support
This commit is contained in:
Emmanuel BENOîT 2016-06-19 18:20:32 +02:00
parent 88676c015e
commit 7486815f7b
13 changed files with 168 additions and 12 deletions

View file

@ -1,11 +1,12 @@
package mmm.tech.base; package mmm.tech.base;
import java.util.List;
import java.util.Random; import java.util.Random;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import mmm.utils.I_USupportBlock; import mmm.utils.UMaths;
import mmm.utils.URegistry; import mmm.utils.URegistry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; 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.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror; import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation; import net.minecraft.util.Rotation;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -36,6 +41,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class TBAlloyFurnaceBlock public class TBAlloyFurnaceBlock
extends BlockContainer 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 static final PropertyDirection FACING = BlockHorizontal.FACING;
public final boolean active; public final boolean active;
@ -49,6 +57,9 @@ public class TBAlloyFurnaceBlock
this.setResistance( 17.5f ); this.setResistance( 17.5f );
this.setHardness( 3.5f ); this.setHardness( 3.5f );
this.setHarvestLevel( "pickaxe" , 0 ); this.setHarvestLevel( "pickaxe" , 0 );
this.lightOpacity = 0;
this.translucent = false;
this.fullBlock = false;
URegistry.setIdentifiers( this , "tech" , "base" , "alloy_furnace" , active ? "active" : "inactive" ); URegistry.setIdentifiers( this , "tech" , "base" , "alloy_furnace" , active ? "active" : "inactive" );
} }
@ -65,7 +76,7 @@ public class TBAlloyFurnaceBlock
// ************************************************************************************************* // *************************************************************************************************
// RENDERING // RENDERING AND COLLISIONS
// ************************************************************************************************* // *************************************************************************************************
@Override @Override
@ -82,6 +93,13 @@ public class TBAlloyFurnaceBlock
} }
@Override
public EnumBlockRenderType getRenderType( final IBlockState state )
{
return EnumBlockRenderType.MODEL;
}
@Override @Override
@SideOnly( Side.CLIENT ) @SideOnly( Side.CLIENT )
public BlockRenderLayer getBlockLayer( ) 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 // ITEM
// ************************************************************************************************* // *************************************************************************************************
@ -215,17 +249,10 @@ public class TBAlloyFurnaceBlock
// ************************************************************************************************* // *************************************************************************************************
@Override @Override
public void neighborChanged( final IBlockState state , final World worldIn , final BlockPos pos , public boolean isSideSolid( final IBlockState base_state , final IBlockAccess world , final BlockPos pos ,
final Block blockIn ) final EnumFacing side )
{ {
I_USupportBlock.dropIfUnsupported( state , worldIn , pos , this ); return side == EnumFacing.DOWN;
}
@Override
public boolean canPlaceBlockAt( final World worldIn , final BlockPos pos )
{
return super.canPlaceBlockAt( worldIn , pos ) && I_USupportBlock.check( worldIn , pos );
} }
} }

View file

@ -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 }
}
}

View file

@ -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 }
}
}

View file

@ -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" }
}
}
]
}

View file

@ -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"
}
}

View file

@ -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"
}
}

View file

@ -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 ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B