Leaves fixes
+ No longer decay when placed + Render using settings from Blocks.LEAVES
This commit is contained in:
parent
a90bd955fb
commit
8b1455c8fd
1 changed files with 44 additions and 0 deletions
|
@ -12,12 +12,17 @@ import net.minecraft.block.BlockPlanks;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
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.entity.EntityLivingBase;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
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.SideOnly;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,10 +36,25 @@ public class MLeaves
|
||||||
public MLeaves( final MWood wood )
|
public MLeaves( final MWood wood )
|
||||||
{
|
{
|
||||||
this.wood = wood;
|
this.wood = wood;
|
||||||
|
|
||||||
|
this.setDefaultState( this.blockState.getBaseState( ) //
|
||||||
|
.withProperty( BlockLeaves.CHECK_DECAY , true )//
|
||||||
|
.withProperty( BlockLeaves.DECAYABLE , true ) );
|
||||||
|
|
||||||
URegistry.setIdentifiers( this , "materials" , "leaves" , wood.NAME );
|
URegistry.setIdentifiers( this , "materials" , "leaves" , wood.NAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState onBlockPlaced( final World worldIn , final BlockPos pos , final EnumFacing facing ,
|
||||||
|
final float hitX , final float hitY , final float hitZ , final int meta , final EntityLivingBase placer )
|
||||||
|
{
|
||||||
|
return this.getDefaultState( ) //
|
||||||
|
.withProperty( BlockLeaves.CHECK_DECAY , false ) //
|
||||||
|
.withProperty( BlockLeaves.DECAYABLE , false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped( final IBlockState state , final Random rand , final int fortune )
|
public Item getItemDropped( final IBlockState state , final Random rand , final int fortune )
|
||||||
{
|
{
|
||||||
|
@ -109,4 +129,28 @@ public class MLeaves
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly( Side.CLIENT )
|
||||||
|
public BlockRenderLayer getBlockLayer( )
|
||||||
|
{
|
||||||
|
return Blocks.LEAVES.getBlockLayer( );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube( final IBlockState state )
|
||||||
|
{
|
||||||
|
return Blocks.LEAVES.isOpaqueCube( state );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly( Side.CLIENT )
|
||||||
|
public boolean shouldSideBeRendered( final IBlockState state , final IBlockAccess world , final BlockPos pos ,
|
||||||
|
final EnumFacing side )
|
||||||
|
{
|
||||||
|
return Blocks.LEAVES.shouldSideBeRendered( state , world , pos , side );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue