Files
PrimalSorcery/build/tmp/recompileMc/sources/net/minecraft/block/BlockWeb.java
Mohammad-Ali Minaie b86dedad2f base mod created
2018-10-08 09:07:47 -04:00

115 lines
3.8 KiB
Java

package net.minecraft.block;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
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;
public class BlockWeb extends Block implements net.minecraftforge.common.IShearable
{
public BlockWeb()
{
super(Material.WEB);
this.setCreativeTab(CreativeTabs.DECORATIONS);
}
/**
* Called When an Entity Collided with the Block
*/
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
entityIn.setInWeb();
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
return NULL_AABB;
}
public boolean isFullCube(IBlockState state)
{
return false;
}
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Items.STRING;
}
protected boolean canSilkHarvest()
{
return true;
}
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
/**
* Spawns the block's drops in the world. By the time this is called the Block has possibly been set to air via
* Block.removedByPlayer
*/
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack)
{
if (!worldIn.isRemote && stack.getItem() == Items.SHEARS)
{
player.addStat(StatList.getBlockStats(this));
spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te, stack);
}
}
@Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) { return true; }
@Override
public java.util.List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
return com.google.common.collect.Lists.newArrayList(new ItemStack(Item.getItemFromBlock(this)));
}
/**
* Get the geometry of the queried face at the given position and state. This is used to decide whether things like
* buttons are allowed to be placed on the face, or how glass panes connect to the face, among other things.
* <p>
* Common values are {@code SOLID}, which is the default, and {@code UNDEFINED}, which represents something that
* does not fit the other descriptions and will generally cause other things not to connect to the face.
*
* @return an approximation of the form of the given face
*/
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
{
return BlockFaceShape.UNDEFINED;
}
}