Java Code Examples for net.minecraft.entity.player.EntityPlayer#addExhaustion()

The following examples show how to use net.minecraft.entity.player.EntityPlayer#addExhaustion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockYuba.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack)
{
    player.addStat(StatList.getBlockStats(this), 1);
    player.addExhaustion(0.025F);

    if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0)
    {
        this.dropYuba(worldIn, pos, state);
    }
    else
    {
        if (stack != null && OreDictionary.containsMatch(false, OreDictionary.getOres("stickWood"), new ItemStack(Items.STICK)))
        {
            this.dropYuba(worldIn, pos, state);
        }
    }
}
 
Example 2
Source File: BlockMarbleIce.java    From Chisel with GNU General Public License v2.0 6 votes vote down vote up
@Override
    public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
    {
        super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);

        par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
        par2EntityPlayer.addExhaustion(0.025F);

/*
        if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer))
        {
            ItemStack itemstack = this.createStackedBlock(par6);

            if(itemstack != null)
            {
                this.dropBlockAsItem(par1World, par3, par4, par5, itemstack);
            }
        }
        */
    }
 
Example 3
Source File: BlockCarvablePackedIce.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
	super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);

	par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
	par2EntityPlayer.addExhaustion(0.025F);

	/*
	 * if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack =
	 * this.createStackedBlock(par6);
	 * 
	 * if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4, par5, itemstack); } }
	 */
}
 
Example 4
Source File: BlockCarvableIce.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
	super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);

	par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
	par2EntityPlayer.addExhaustion(0.025F);

	/*
	 * if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack =
	 * this.createStackedBlock(par6);
	 * 
	 * if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4, par5, itemstack); } }
	 */
}
 
Example 5
Source File: BlockBackpack.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@Override
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
	player.addStat(StatList.getBlockStats(this));
	player.addExhaustion(0.005F);

	harvesters.set(player);
	dropBackpack(worldIn, pos, te);
	harvesters.set(null);
}
 
Example 6
Source File: OpenBlock.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Override
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, @Nonnull ItemStack stack) {
	player.addStat(StatList.getBlockStats(this));
	player.addExhaustion(0.025F);

	if (canSilkHarvest(world, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0) {
		handleSilkTouchDrops(world, player, pos, state, te);
	} else {
		handleNormalDrops(world, player, pos, state, te, stack);
	}
}
 
Example 7
Source File: ItemReinforcedDiamondArmor.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {

	if (player.isInWater()) {

	}

	// Minecraft.getMinecraft().thePlayer.movementInput =

	effectPlayer(player, MobEffects.SLOWNESS, 2);

	// effectPlayer(player, MobEffects.jump, -2);

	if (player.isSwingInProgress) {
		player.addExhaustion(0.025f);
	}
}
 
Example 8
Source File: BlockPitKiln.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack)
{
	player.addStat(StatList.getBlockStats(this));
	player.addExhaustion(0.005F);
}