/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 28, 2015, 10:46:20 PM (GMT)]
*/
package vazkii.botania.common.block;
import java.util.Random;
import javax.annotation.Nonnull;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
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;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockBifrostPerm extends BlockMod implements ILexiconable {
public BlockBifrostPerm() {
super(Material.GLASS, LibBlockNames.BIFROST_PERM);
setLightOpacity(0);
setHardness(0.3F);
setLightLevel(1F);
setSoundType(SoundType.GLASS);
setTickRandomly(true);
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullBlock(IBlockState state) {
return true;
}
@Override
public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) {
if (world.getBlockState(pos.offset(side)).getBlock() == this) {
return false;
}
return super.shouldSideBeRendered(state, world, pos, side);
}
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
if(rand.nextBoolean())
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
return LexiconData.rainbowRod;
}
}