2016-02-20 01:55:18 +01:00
|
|
|
package techreborn.blocks;
|
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.Random;
|
|
|
|
|
2016-02-20 20:59:09 +01:00
|
|
|
import me.modmuss50.jsonDestroyer.api.IOpaqueBlock;
|
2016-02-20 01:55:18 +01:00
|
|
|
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
|
|
|
import net.minecraft.block.BlockLeaves;
|
|
|
|
import net.minecraft.block.BlockPlanks;
|
2016-07-19 06:26:41 +02:00
|
|
|
import net.minecraft.block.material.Material;
|
2016-02-20 01:55:18 +01:00
|
|
|
import net.minecraft.block.properties.IProperty;
|
2016-03-13 17:08:30 +01:00
|
|
|
import net.minecraft.block.state.BlockStateContainer;
|
2016-02-20 01:55:18 +01:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.init.Blocks;
|
2016-02-20 20:46:18 +01:00
|
|
|
import net.minecraft.item.Item;
|
2016-02-20 01:55:18 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
2016-03-13 19:38:41 +01:00
|
|
|
import net.minecraft.util.BlockRenderLayer;
|
2016-02-20 01:55:18 +01:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2016-03-15 09:13:05 +01:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2016-02-20 01:55:18 +01:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
import reborncore.RebornCore;
|
|
|
|
import techreborn.client.TechRebornCreativeTabMisc;
|
2016-02-20 20:46:18 +01:00
|
|
|
import techreborn.init.ModBlocks;
|
2016-02-20 01:55:18 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-07 21:33:08 +01:00
|
|
|
* Created by modmuss50 on 20/02/2016.
|
2016-02-20 01:55:18 +01:00
|
|
|
*/
|
2016-03-25 10:47:34 +01:00
|
|
|
public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IOpaqueBlock
|
|
|
|
{
|
2016-02-20 01:55:18 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public BlockRubberLeaves()
|
|
|
|
{
|
2016-02-20 01:55:18 +01:00
|
|
|
setUnlocalizedName("techreborn.rubberleaves");
|
|
|
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
|
|
|
RebornCore.jsonDestroyer.registerObject(this);
|
2016-04-03 15:34:39 +02:00
|
|
|
this.setDefaultState(this.getDefaultState().withProperty(CHECK_DECAY, true)
|
|
|
|
.withProperty(DECAYABLE, true));
|
2016-07-19 06:26:41 +02:00
|
|
|
Blocks.FIRE.setFireInfo(this, 30, 60);
|
2016-02-20 01:55:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-25 10:47:34 +01:00
|
|
|
public BlockPlanks.EnumType getWoodType(int meta)
|
|
|
|
{
|
2016-02-20 01:55:18 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-25 10:47:34 +01:00
|
|
|
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
|
|
|
|
{
|
2016-04-03 15:34:39 +02:00
|
|
|
List<ItemStack> list = new java.util.ArrayList<>();
|
2016-02-20 01:55:18 +01:00
|
|
|
list.add(new ItemStack(this, 1, 0));
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-13 19:38:41 +01:00
|
|
|
public BlockRenderLayer getBlockLayer()
|
2016-02-20 01:55:18 +01:00
|
|
|
{
|
2016-04-23 14:05:39 +02:00
|
|
|
return BlockRenderLayer.CUTOUT_MIPPED;
|
2016-02-20 01:55:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-13 19:38:41 +01:00
|
|
|
public boolean isOpaqueCube(IBlockState state)
|
2016-02-20 01:55:18 +01:00
|
|
|
{
|
2016-04-23 14:05:39 +02:00
|
|
|
return false;
|
2016-02-20 01:55:18 +01:00
|
|
|
}
|
|
|
|
|
2016-02-20 20:46:18 +01:00
|
|
|
public boolean isFullCube()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-02-20 01:55:18 +01:00
|
|
|
@Override
|
|
|
|
protected ItemStack createStackedBlock(IBlockState state)
|
|
|
|
{
|
2016-04-03 15:34:39 +02:00
|
|
|
IBlockState newState = state.withProperty(CHECK_DECAY, false).withProperty(DECAYABLE,
|
|
|
|
false);
|
2016-02-20 01:55:18 +01:00
|
|
|
|
|
|
|
return super.createStackedBlock(newState);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-25 10:47:34 +01:00
|
|
|
public String getTextureNameFromState(IBlockState IBlockState, EnumFacing enumFacing)
|
|
|
|
{
|
2016-02-20 01:55:18 +01:00
|
|
|
return "techreborn:blocks/rubber_leaves";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-25 10:47:34 +01:00
|
|
|
public int amountOfStates()
|
|
|
|
{
|
2016-02-20 01:55:18 +01:00
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-13 19:38:41 +01:00
|
|
|
protected BlockStateContainer createBlockState()
|
2016-02-20 01:55:18 +01:00
|
|
|
{
|
2016-03-25 10:47:34 +01:00
|
|
|
return new BlockStateContainer(this, new IProperty[] { CHECK_DECAY, DECAYABLE });
|
2016-02-20 01:55:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IBlockState getStateFromMeta(int meta)
|
|
|
|
{
|
2016-04-03 15:34:39 +02:00
|
|
|
return this.getDefaultState().withProperty(DECAYABLE, (meta & 1) == 0)
|
|
|
|
.withProperty(CHECK_DECAY, (meta & 2) > 0);
|
2016-02-20 01:55:18 +01:00
|
|
|
}
|
2016-03-25 10:47:34 +01:00
|
|
|
|
2016-02-20 01:55:18 +01:00
|
|
|
@Override
|
|
|
|
public int getMetaFromState(IBlockState state)
|
|
|
|
{
|
|
|
|
int meta = 0;
|
2016-04-03 15:34:39 +02:00
|
|
|
if (!(Boolean) state.getValue(DECAYABLE))
|
2016-02-20 01:55:18 +01:00
|
|
|
{
|
|
|
|
meta |= 1;
|
|
|
|
}
|
2016-04-03 15:34:39 +02:00
|
|
|
if ((Boolean) state.getValue(CHECK_DECAY))
|
2016-02-20 01:55:18 +01:00
|
|
|
{
|
|
|
|
meta |= 2;
|
|
|
|
}
|
|
|
|
return meta;
|
|
|
|
}
|
2016-02-20 11:58:58 +01:00
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public int getBlockColor()
|
|
|
|
{
|
|
|
|
return 16777215;
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public int getRenderColor(IBlockState state)
|
|
|
|
{
|
|
|
|
return 16777215;
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
|
|
|
|
{
|
|
|
|
return 16777215;
|
|
|
|
}
|
2016-02-20 20:46:18 +01:00
|
|
|
|
|
|
|
@Override
|
2016-03-25 10:47:34 +01:00
|
|
|
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
|
|
|
{
|
2016-02-20 20:46:18 +01:00
|
|
|
return Item.getItemFromBlock(ModBlocks.rubberSapling);
|
|
|
|
}
|
2016-02-20 01:55:18 +01:00
|
|
|
}
|