package minefantasy.block; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.util.Icon; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockIceMF extends BlockBreakable { public BlockIceMF(int id, int tex) { super(id, "Ice_MF", Material.ice, false); this.slipperiness = 0.98F; this.setTickRandomly(true); } @SideOnly(Side.CLIENT) /** * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha */ public int getRenderBlockPass() { return 1; } @SideOnly(Side.CLIENT) /** * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given * coordinates. Args: blockAccess, x, y, z, side */ public boolean shouldSideBeRendered(IBlockAccess block, int x, int y, int z, int meta) { return super.shouldSideBeRendered(block, x, y, z, 1 - meta); } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister reg){} /** * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the * block and l is the block's subtype/damage. */ public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { player.addStat(StatList.mineBlockStatArray[this.blockID], 1); player.addExhaustion(0.025F); if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) { ItemStack var9 = this.createStackedBlock(meta); if (var9 != null) { this.dropBlockAsItem_do(world, x, y, z, var9); } } else { world.setBlockToAir(z, y, z); } } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random rand) { return 0; } protected ItemStack createStackedBlock(int meta) { int var2 = 0; if (this.blockID >= 0 && this.blockID < Item.itemsList.length && Item.itemsList[this.blockID].getHasSubtypes()) { var2 = meta; } return new ItemStack(Block.ice.blockID, 1, var2); } @Override public Icon getIcon(int side, int meta) { return Block.ice.getIcon(side, meta); } /** * Ticks the block if it's been scheduled */ public void updateTick(World world, int x, int y, int z, Random rand) { world.setBlockToAir(x, y, z); } /** * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility * and stop pistons */ public int getMobilityFlag() { return 0; } }